Definitelytyped: @types/react-weui: JSX element type 'Button' is not a constructor function for JSX elements. Property 'setState' is missing in type 'Button'.

Created on 23 Aug 2017  路  2Comments  路  Source: DefinitelyTyped/DefinitelyTyped

@types/react-weui can't import component

import * as React from 'react';
import { Button } from 'react-weui';

interface Props extends React.Props<any> {  // tslint:disable-line

}

interface State { }

class WechatOAuth extends React.Component<Props, State> {
  render() {
    return (
      <div>
        <Button>hello</Button>
      </div>
    );
  }
}

the tslint show the error message

[ts]
JSX element type 'Button' is not a constructor function for JSX elements.
  Property 'setState' is missing in type 'Button'.
[ts] JSX element class does not support attributes because it does not have a 'props' property.
import Button
  • Authors: @tairan

All 2 comments

I think the index.d.ts should be:

tsx class Button extends React.Component<IButtonProps, IButtonState>

i very hate u guys, dont speak useless things , okay???

Was this page helpful?
0 / 5 - 0 ratings