Skip to content

getDerivedStateFromProps(): A valid state object (or null) must be returned #116

@urakozz

Description

@urakozz
  • Bug

Problem Report

This component throws warning
getDerivedStateFromProps(): A valid state object (or null) must be returned

Problem was described here facebook/react#12562 and solution is to return a null instead of implicit undefined

image

System Info

Node Version: v12.12.0
Browser: Chrome 78
OS: Mac OS 10.14.6

Reproduction

In the codesandbox there is no warning ¯_(ツ)_/¯

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