Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
square = () => {
// facebook/react#13488 seems to imply deferredUpdates is no longer necessary
// Also see note in changelog: facebook/react#13571
scheduler.unstable_scheduleCallback(scheduler.unstable_IdlePriority, () =>
this.setState(prevState => ({
values: prevState.values.map(value => value * value)
}))
);
};
addChild = () => {
scheduler.unstable_scheduleCallback(scheduler.unstable_IdlePriority, () =>
this.setState(prevState => ({
values: [...prevState.values, prevState.values.length + 1]
}))
);
};