virtualvivek / react-windows-ui

Build Windows native look & feel apps using ReactJS. Provides a set of accessible, reusable and composable react components that make it super easy to create websites and apps.
https://virtualvivek.github.io/react-windows-ui/
MIT License
537 stars 44 forks source link

Improved Typescript Definitions #5

Closed Myzel394 closed 3 years ago

virtualvivek commented 3 years ago

HI @Myzel394 ,

  1. The new definitions is giving this error
E:/npm/react-ts-app/src/App.tsx
TypeScript error in E:/npm/react-ts-app/src/App.tsx(23,12):
JSX element type 'Alert' does not have any construct or call signatures.  TS2604

    21 |    
    22 | 
  > 23 |           <Alert isVisible={true}/>
       |            ^

Can you please check in your system why its happening.

  1. we added space in the definitions for better code readibility. Eg: title ?: string;
virtualvivek commented 3 years ago

Since from the following Stackoverflow Answer

1 Answer

You should use React.FunctionComponent: Rename React's SFC to FunctionalComponent

This PR renames React.SFC and React.StatelessComponent to React.FunctionComponent, while introducing deprecated aliases for the old names.

So your example would become:

const example: React.FunctionComponent<IExample> = ({propsType}) => ();
or

const example: React.FC<IExample> = ({propsType}) => ();

From the above following stackoverflow answer for arrow functions we now using React.FC or React.FunctionComponent