These are chat archives for jdubray/sam

28th
Oct 2018
Jean-Jacques Dubray
@jdubray
Oct 28 2018 11:01

so I was thinking a bit about React Hooks and I believe they will create their own mess. Here is why:

  • setXxx(xyz) is an effect and in a real world context it will be rarely as simple as xxx = xyz
  • useEffect doesn't have any provision to access the global state (other component state), because, again the effects woul never be as simple as being bounded by component state.

This is hopeless.
Incidentally, it's hilarious that the most basic hook example ends up doing a DOM manipulation

useEffect(() => {
    // Update the document title using the browser API
    document.title = `You clicked ${count} times`;
  });