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
Awesome blog post! It has been the best guide that I've ever read and really helped me understand the internals of React Fiber architecture.
One thing that I notice is that inside the useState, the setState will always set nextUnitOfWork = wipRoot, which means Didact will reconcile from the root. And inside updateFunctionComponent, the function component will always call fiber.type(fiber.props) which will cause the component re-render. But I believe this is not the case in React?
<Parent><Children/></Parent>constParent=({ children })=>{console.log('parent re-render')return<div>{children}</div>}constChildren=(props)=>{const[state,setState]=useState(0);console.log('child re-render')return<buttononClick={()=>setState(state+1)}>Click</button>}
In actual React, when the <Children> button is clicked and setState is invoked, the <Parent> component will not-rerender. It is reflected by the parent console.log, which doesn't run again.
So my question is, how does Didact differ from React in this case? Which React's feature is not implemented in Didact?
Thanks
The text was updated successfully, but these errors were encountered:
Awesome blog post! It has been the best guide that I've ever read and really helped me understand the internals of React Fiber architecture.
One thing that I notice is that inside the
useState
, thesetState
will always setnextUnitOfWork = wipRoot
, which means Didact will reconcile from the root. And insideupdateFunctionComponent
, the function component will always callfiber.type(fiber.props)
which will cause the component re-render. But I believe this is not the case in React?For example, we have this structure: https://playcode.io/1603467
In actual React, when the
<Children>
button is clicked andsetState
is invoked, the<Parent>
component will not-rerender. It is reflected by the parentconsole.log
, which doesn't run again.So my question is, how does Didact differ from React in this case? Which React's feature is not implemented in Didact?
Thanks
The text was updated successfully, but these errors were encountered: