StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
746 stars 415 forks source link

Using mobx with react-big-scheduler #180

Open Bosseskompis opened 4 years ago

Bosseskompis commented 4 years ago

Has anyone managed to use this library with Mobx? Changes don't cause rerender when schedulerData is an observable.

Bosseskompis commented 4 years ago

I'm using a workaround for now where I am resetting the schedulerData with an empty object before updating it with the changes

KotovaZ commented 3 years ago

https://mobx.js.org/reactions.html

Example:

const [, updateState] = useState();
const forceUpdate = useCallback(() => updateState({}), []);

  React.useEffect(
    () =>
      autorun(() => {
        schedulerData.setDate(props.params.date_from);
        schedulerData.setEvents(props.events);
        forceUpdate();
      }),
    [],
  )