News for hackers. Stuff that matters.
Re:React Fundamentals: What I’m Learning by ritchiea on Tuesday November 03, 2020 @03:40PM (#24983726)
The latest consensus is to avoid class components, use only functional components and use hooks to handle state & side effects. Ninety percent of React is building DOM, hitting APIs with an HTTP client and using useState + useEffect. And remembering that you must pass functions & data to child elements to communicate between or share logic across components.
Re:React Fundamentals: What I’m Learning by poyu on Tuesday November 03, 2020 @07:42PM (#24985676)
What’s the reason to avoid class components though? The official tutorial still uses it, though that could just be because it’s outdated?
Re:React Fundamentals: What I’m Learning by acemarke on Wednesday November 04, 2020 @11:36AM (#24990524)
The React team is currently working on a complete rewrite of the docs, which will include a focus on hooks first:

https://github.com/reactjs/reactjs.org/issues/3308

In the meantime, someone else ported the existing docs to teach function components and hooks in the examples:

https://reactwithhooks.netlify.app/

Re:React Fundamentals: What I’m Learning by ritchiea on Tuesday November 03, 2020 @08:17PM (#24985857)
The zeitgeist is that hooks are easier to reason about than life cycle methods, functional components are more lightweight and result in less bundled code.
Re:React Fundamentals: What I’m Learning by hitekker on Tuesday November 03, 2020 @09:35PM (#24986140)
It's more of a hype train than a "zeitgeist". Major community contributors like Jared Palmer have stepped forward in the past year to critique the complexity of React hooks.

https://jaredpalmer.com/blog/react-is-becoming-a-black-box

https://dillonshook.com/a-critique-of-react-hooks-addendum/

Personally, I think blindly adopting the latest frontend trends is the opposite of being "radically pragmatic".

Re:React Fundamentals: What I’m Learning by ritchiea on Wednesday November 04, 2020 @03:38PM (#24992824)
What's more pragmatic than not being precious about what technology decision is most perfect and instead going with what's popular and has a lot of community support?
Re:React Fundamentals: What I’m Learning by ritchiea on Tuesday November 03, 2020 @10:28PM (#24986283)
Ok! Your opinion is noted