react-big-scheduler
react-big-scheduler copied to clipboard
Using mobx with react-big-scheduler
Has anyone managed to use this library with Mobx? Changes don't cause rerender when schedulerData is an observable.
I'm using a workaround for now where I am resetting the schedulerData with an empty object before updating it with the changes
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();
}),
[],
)