You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const ComponentA = observer(() => {
const model = useLocalObservable(() => new ClassA())
return <div onClick={model.handleClick}>CLICK</div>
})
Say you decide to change the body of handleClick method to console.log('TEST B').
When using react-refresh, the component updates but the class method does not, it still logs out "TEST A".
Is there a mechanism to update/reload the model's methods while keeping the observable properties untouched (keeping its state intact), without a page reload?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using this example class:
Using this example (React) component:
Say you decide to change the body of
handleClick
method toconsole.log('TEST B')
.When using react-refresh, the component updates but the class method does not, it still logs out "TEST A".
Is there a mechanism to update/reload the model's methods while keeping the observable properties untouched (keeping its state intact), without a page reload?
Beta Was this translation helpful? Give feedback.
All reactions