Skip to content

edge case when using with hooks #433

Closed
@H2rmone

Description

@H2rmone

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>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions