Skip to content

Context.Consumer unexpectedly updates each time one of its child components call setState #12218

@jaredLunde

Description

@jaredLunde

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

  • Report a bug

What is the current behavior?

  • Each time a child component of Context.Consumer calls setState, its parent Context.Consumer re-renders.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

What is the expected behavior?

  • Presumably the expected behavior is one where setting the state of a child component does not affect any parent Context.Consumer components, particularly when that state does not change

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

  • Versions
    • 16.3.0-alpha.1
    • 16.3.0-alpha.0
  • Browser
    • Chrome (OSX 10.13.3) 64.0.3282.140
  • This works as expected when the previous context API is used

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions