Skip to content

"Rendered fewer hooks than expected" upon deletion of todo list item #14204

@staltz

Description

@staltz

Do you want to request a feature or report a bug? Bug

What is the current behavior?

Codesandbox: https://codesandbox.io/s/1vy8n91y7 add a few todo items to the list, then press one of the red X buttons to delete one of them.

What is the expected behavior?

The todo item gets deleted.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

React 16.7.0-alpha.0 using hooks.


TL;DR of useProfunctorState hook: underneath it uses useState and useMemo. For each useProfunctorState call, there is only one call of useState. Children components that use promap don't have their own real "setState", instead they all share the setState from the top-level component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions