2 ms·
React embraces one-way data flow. You build a tree-like structure of components each of which is configured by the props passed to it by its parent. Each compon
by schwartzworld 2y ago
React embraces one-way data flow. You build a tree-like structure of components each of which is configured by the props passed to it by its parent. Each component is a function that runs again every time any of the props change. Components also have the ability to manage local state, which is simple in some ways but handled poorly can lead to a lot of complexity. React doesn't give you a lot of guard rails, but it does give you a lot of power. You can tell the best React developers by how they handle state and side effects.
Most of your components in a React app should be pure functions, meaning their output for a combination of props should be the same every time. This makes testing extremely easy, although YMMV depending on how you structure your app. React lets you write lots of cheap and almost unbreakable lego pieces that you can assemble into larger blocks of functionality.