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

edge case when using with hooks #433

Closed
H2rmone opened this issue Jun 24, 2021 · 6 comments
Closed

edge case when using with hooks #433

H2rmone opened this issue Jun 24, 2021 · 6 comments

Comments

@H2rmone
Copy link

H2rmone commented Jun 24, 2021

Reproduce demo: https://codesandbox.io/s/goofy-framework-v0tjf?file=/src/App.js

When config is a initialValue reference as useState, modify config doesn't update content. should we implement this feature?

// after changing config to 2, the content is not update.
// const config = 1
const config = 2

function App() {
  const [state] = useState(config)

  return <div>{state}</div>
}

anther possible usage:

function App() {
  // after changing config to 2, the content is update.
  // const [state] = useState(1)
  const [state] = useState(2)

  return <div>{state}</div>
}
@BARMPlus
Copy link

I also encountered this problem,Is there any solution。

@pmmmwh
Copy link
Owner

pmmmwh commented Jun 27, 2021

This is an issue of CRA instead of us. See facebook/create-react-app#11105

@H2rmone
Copy link
Author

H2rmone commented Jun 28, 2021

Thanks!

@H2rmone H2rmone closed this as completed Jun 28, 2021
@aladdin-add
Copy link

encountered the same issue, but we are not using CRA. @pmmmwh, do you think something can be done in the plugin?

@aladdin-add
Copy link

I can make a repro later (if needed).

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 5, 2021

@aladdin-add Please create a reproduction in a new issue.

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

4 participants