![]() ![]() With this, our component tree becomes a big "view", and any component can access the state or trigger actions, no matter where they are in the tree!īy defining and separating the concepts involved in state management and enforcing rules that maintain independence between views and states, we give our code more structure and maintainability. ![]() One way to solve this is to extract the shared state from the components, and put it into a centralized location outside the component tree. ![]() Sometimes this can be solved by "lifting state up" to parent components, but that doesn't always help. However, the simplicity can break down when we have multiple components that need to share and use the same state, especially if those components are located in different parts of the application. The UI re-renders based on the new state.When something happens (such as a user clicking a button), the state is updated based on what occurred.State describes the condition of the app at a specific point in time.This is a small example of "one-way data flow": The actions, the events that occur in the app based on user input, and trigger updates in the state.The view, a declarative description of the UI based on the current state.The state, the source of truth that drives our app.It is a self-contained app with the following parts: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |