Skip to content

Commit

Permalink
Update useMachine.js
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrybinski authored Nov 3, 2021
1 parent 7e2c3a6 commit bd4eba3
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions useMachine.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ export function useMachine(machine, options = {}) {
const [state, setState] = createStore({
...service.initialState,
matches(...args) {
// access state to track on value access
state.value;
return service.state.matches(...args);
}
});
service.onTransition((s) => {
// only focus on stuff that actually changes
batch(() => {
setState("value", s.value);
// diff data to only update values that changes
setState("context", reconcile(s.context));
});
});
Expand Down

0 comments on commit bd4eba3

Please sign in to comment.