setState method
void
setState(
- Component2 component,
- Map? newState,
- SetStateCallback? callback
)
override
Implementation
@override
void setState(Component2 component, Map? newState, SetStateCallback? callback) {
// Short-circuit to match the ReactJS 16 behavior of not re-rendering the component if newState is null.
if (newState == null) return;
final firstArg = jsBackingMapOrJsCopy(newState);
if (callback == null) {
component.jsThis.setState(firstArg);
} else {
component.jsThis.setState(firstArg, allowInterop(([_]) {
callback();
}));
}
}