Closed untlsn closed 2 years ago
Mobx only works when using the observator without memo.
// Work but deprecated const Button = () => useObserver(() => { const count = useLocalObservable(() => ({ value: 0, })) return ( <button onClick={action(() => { count.value++; })}>{count.value}</button> ) } )
// Dont work const Button = React.memo(() => useObserver(() => { const count = useLocalObservable(() => ({ value: 0, })) return ( <button onClick={action(() => { count.value++; })}>{count.value}</button> ) } )) const Button = observer(() => { const count = useLocalObservable(() => ({ value: 0, })) return ( <button onClick={action(() => { count.value++; })}>{count.value}</button> ) } )
Additionally, it gets an unusual output
(props) => { return component(Object.values(props)); }
Maybe this repository is for you https://github.com/mobxjs/mobx
Mobx only works when using the observator without memo.
Additionally, it gets an unusual output