localvoid/ivi

useEffect docs wrong?

leeoniya opened this issue · 1 comments

@localvoid

mistake?

also, is useUnmount() identical to the cleanup function returned from useEffect()?

also (unrelated), i see that updateRoot() has been renamed update(), but the first arg is still called root. we also have createRoot(). feels like a naming inconsistency now?

the README still has updateRoot( in its examples

mistake?

No, useEffect that doesn't depend on any inputs can be immediately invoked just once in the outer scope.

is useUnmount() identical to the cleanup function returned from useEffect() ?

Yes. useEffect() uses useUnmount() to add unmount hooks.

feels like a naming inconsistency now?

When I've reduced API surface a couple of days ago, I've made update(), dirtyCheck(), etc that used flags in their arguments as private and just renamed updateRoot() to update(). Personally, I don't care how this functions are named and I just didn't want to rename createRoot() to something like root() to make it more consistent.

And to make it more consistent with createRoot() it will be necessary to rename dirtyCheck, unmount, hydrate, update. I just wanted to keep it simple.