Skip to content

UNSAFE_* Lifecycle hooks don't run if getDerivedStateFromProps is present #12411

Closed
@jquense

Description

@jquense

https://codesandbox.io/s/xl7k7j1k6w

Not sure if this is intended or not, the longer term existence of these hooks suggested to me that they have their purposes still, so might be needed in conjunction with gDSFP. The particular use-case that caused me to discover this was a migrating: https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Dropdown.js#L137 where document focus needs to be checked prior to an update flushing because the update changes visual state and drops focus. I could move this to render() but React has traditionally yelled at me when doing ref stuff there. Admittedly in the migrated code i don't need findDOMNode so it'd be fine.

Metadata

Metadata

Assignees

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