4 ms·
Far as I see they aren't. They're recommending you don't use unnecessary state. From the example, if you have state for `firstName` and `lastName`, you don't ne
by _thisdot 4y ago
Far as I see they aren't. They're recommending you don't use unnecessary state. From the example, if you have state for `firstName` and `lastName`, you don't need another state for `fullName`. Just calculate it during the render as `'${firstName} ${lastName}'`
- foota 4y agoThey're referring to https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes https://react.dev/learn/you-might-not-need-an-effect#adjusti..., where they literally call setFoor in the render method. I guess this makes sense, but it's weird after all the "never do anything stateful in render"