iulianraduat / react-select-material-ui

A react SELECT component based on react-select and looking like a material-ui component
MIT License
73 stars 18 forks source link

Typescript error: '*Select' cannot be used as a JSX component #45

Closed NathanC closed 1 year ago

NathanC commented 2 years ago

Hi! I'm trying to import this library, using React 18, and am getting this error with any of the selects I try to use. For example, TagSelect:

'TagsSelect' cannot be used as a JSX component.
  Its instance type 'TagsSelect' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'import("/home/myusername/Programming/myproject/node_modules/react-select-material-ui/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
        Type '{}' is not assignable to type 'ReactNode'

I'm creating it normally, e.g.,

<TagsSelect
    label="tags"
    values={values.tags}
    options={tagOptions}
    onChange={() => null}
/>

My gut is saying it has something to do with the difference between React v17 (which this library uses) and React v18, but I'm not sure. Any other ideas or ways I could get this to work?

btw I may be interested in contributing to this project and adding an outlined variant, to better match the theme of the rest of my site.

iulianraduat commented 2 years ago

Hi @NathanC,

You are very welcomed to contribute.

I will take a look to see why you possible get this error.

Cheers, Iulian

iulianraduat commented 2 years ago

Hi @NathanC ,

I just published the v9 and I hope it will "fix" your problem.

Please check it and let me know.

Cheers, Iulian

iulianraduat commented 1 year ago

Closed as there was no response from reporter