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

React hooks useState and useEffect throws errors #1

Closed
cdoremus opened this issue Aug 29, 2020 · 2 comments · Fixed by #2
Closed

React hooks useState and useEffect throws errors #1

cdoremus opened this issue Aug 29, 2020 · 2 comments · Fixed by #2
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cdoremus
Copy link

cdoremus commented Aug 29, 2020

Using React hooks useState and useEffect in deno-react-minimal-frontend causes these errors when running the build script:

TS2339 [ERROR]: Property 'useState' does not exist on type '{}'.
  const [errorMessage, setErrorMessage] = React.useState('')
                                                ~~~~~~~~
    at file:///Users/craigdoremus/git/cdoremus/deno-react-minimal-frontend/src/components/App.tsx:18:49

TS2339 [ERROR]: Property 'useEffect' does not exist on type '{}'.
  React.useEffect(() => {
        ~~~~~~~~~
    at file:///Users/craigdoremus/git/cdoremus/deno-react-minimal-frontend/src/components/App.tsx:20:9

VSCode with the Deno extension installed displays no errors.

When npm start is run, the browser renders a blank page with the following errors in the JavaScript console:

client.bundle.js:18749 The above error occurred in the <App> component:
    in App

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError @ client.bundle.js:18749

Uncaught TypeError: react_16_9_0_2.useState is not a function or its return value is not iterable
    at App (client.bundle.js:23007)
    at renderWithHooks (client.bundle.js:15070)
    at mountIndeterminateComponent (client.bundle.js:16873)
    at beginWork$1 (client.bundle.js:17694)
    at HTMLUnknownElement.callCallback (client.bundle.js:4387)
    at Object.invokeGuardedCallbackDev (client.bundle.js:4413)
    at invokeGuardedCallback (client.bundle.js:4445)
    at beginWork$$1 (client.bundle.js:21298)
    at performUnitOfWork (client.bundle.js:20579)
    at workLoopSync (client.bundle.js:20564)

@quaos
Copy link
Owner

quaos commented Aug 30, 2020

@cdoremus Likely related to this issue: denoland/deno#4539 ;_;

Looking for solutions/workarounds

@quaos quaos added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Aug 30, 2020
@quaos
Copy link
Owner

quaos commented Aug 30, 2020

UPDATE:

@quaos quaos removed the help wanted Extra attention is needed label Aug 31, 2020
@quaos quaos linked a pull request Aug 31, 2020 that will close this issue
@quaos quaos closed this as completed in #2 Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants