Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ReactLoading' cannot be used as a JSX component. #66

Open
mohapakram opened this issue Jul 14, 2022 · 2 comments
Open

'ReactLoading' cannot be used as a JSX component. #66

mohapakram opened this issue Jul 14, 2022 · 2 comments

Comments

@mohapakram
Copy link

Just importing ReactLoading like this:

import ReactLoading from 'react-loading';

Gives me this error:

ERROR in src/components/newDesign/pages/login/LoginPage.tsx:93:38
TS2786: 'ReactLoading' cannot be used as a JSX component.
  Its instance type 'Loading' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("C:/Users/PC/OneDrive/Desktop/iplant/frontend/iplant/node_modules/@types/react-table/node_modules/@types/react/index").ReactNode'.
        Type '{}' is not assignable to type 'ReactNode'.
    91 |                                         <InputItem fullWidth type='password' {...register("password")} />
    92 |                                     </FormItemContainer>
  > 93 |                                     <ReactLoading type='bubbles' color="white" />
       |                                      ^^^^^^^^^^^^
    94 |                                     <FormButton type="submit" disabled={isSubmitting}>
    95 |                                         {isSubmitting ? 'loading' : 'Login'}
    96 |                                     </FormButton>
@bhavyagor12
Copy link

Hey is there a fix available for this?

@bhavyagor12
Copy link

Got around this issue by doing this --
in the tsconfig.json
{
"compilerOptions": {
"jsx":"react",
"strict": true,
"paths": {
"react": [ "./node_modules/@types/react" ]
}
}
}

stack overflow link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants