Closed ljianc closed 1 year ago
Index
snapshot.loading
Content
state .message
const state = proxy({ loading: true, message: "" }); function Index() { const snapshot = useSnapshot(state); const Node = snapshot.loading ? Loading : Content; useEffect(() => { console.log("Log Index Rerendering"); }); useEffect(() => { state.loading = false; }, []); return <Node />; } function Loading() { return <>loading</>; } function Content() { useEffect(() => { //If this is added,Index Rerendering 3 times state.message = "welcome"; //If this is removed,Index Rerendering 2 times //state.message = "welcome"; }, []); return <>test</>; }
Please continue discussion in #716.
Index
component only accesssnapshot.loading
Content
component only setstate .message
Index
component Rerendering 3 times, My understanding should be 2 times