replaceState method

  1. @Deprecated('Use setState instead.')
void replaceState(
  1. Map? newState, [
  2. dynamic callback()?
])
inherited

Set _nextState to provided newState value and force a re-render.

Optionally accepts a callback that gets called after the component updates.

See: reactjs.org/docs/react-component.html#setstate

Implementation

@Deprecated('Use setState instead.')
void replaceState(Map? newState, [Function()? callback]) {
  final nextState = newState == null ? {} : Map.from(newState);
  _nextState = nextState;
  if (callback != null) _setStateCallbacks.add(callback);

  _jsRedraw();
}