How to use the scheduler.unstable_IdlePriority function in scheduler

To help you get started, we’ve selected a few scheduler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewiggins / react-suspense-sandbox / src / fiber / index.jsx View on Github external
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)
      }))
    );
  };
github andrewiggins / react-suspense-sandbox / src / fiber / index.jsx View on Github external
addChild = () => {
    scheduler.unstable_scheduleCallback(scheduler.unstable_IdlePriority, () =>
      this.setState(prevState => ({
        values: [...prevState.values, prevState.values.length + 1]
      }))
    );
  };