getDerivedStateFromError method
ReactJS lifecycle method that is invoked after an error
is thrown by a descendant.
Use this method to capture the error
and update component state
accordingly by
returning a new Map
value that will be merged into the current state
.
This method is effectively static
(since it is static in the JS layer),
so using instance members like props
, state
or ref
will not work.
Note: This method, along with componentDidCatch
will only
be called if skipMethods
in registerComponent2
is overridden with
a list that includes the names of these methods. Otherwise, in order to prevent every
component from being an error boundary, componentDidCatch
and
getDerivedStateFromError
will be ignored.
See: reactjs.org/docs/react-component.html#static-getderivedstatefromerror
Implementation
Map? getDerivedStateFromError(dynamic error) => null;