About 149 results
Open links in new tab
  1. Scaling Up with Reducer and Context – React

    Here is how you can combine a reducer with context: Create the context. Put state and dispatch into context. Use context anywhere in the tree. Step 1: Create the context . The useReducer …

  2. useContext – React

    useContext returns the context value for the context you passed. To determine the context value, React searches the component tree and finds the closest context provider above for that …

  3. Passing Data Deeply with Context – React - code++

    It is common to use a reducer together with context to manage complex state and pass it down to distant components without too much hassle. Context is not limited to static values. If you pass …

  4. Extracting State Logic into a Reducer – React

    To reduce this complexity and keep all your logic in one easy-to-access place, you can move that state logic into a single function outside your component, called a “reducer”. Reducers are a …

  5. useReducer – React

    reducer: The reducer function that specifies how the state gets updated. It must be pure, should take the state and action as arguments, and should return the next state. State and action can …

  6. 使用 Context 深层传递参数 – React 中文文档

    通常 将 reducer 与 context 搭配使用来管理复杂的状态并将其传递给深层的组件来避免过多的麻烦。 Context 不局限于静态值。 如果你在下一次渲染时传递不同的值,React 将会更新读取它的 …

  7. createContext – React

    createContext returns a context object. The context object itself does not hold any information. It represents which context other components read or provide. Typically, you will use …

  8. use – React

    Reading context with use. When a context is passed to use, it works similarly to useContext. While useContext must be called at the top level of your component, use can be called inside …

  9. Transmettre des données en profondeur avec le contexte – React

    Ne serait-ce pas génial s’il existait une façon de « téléporter » la valeur jusqu’aux composants de l’arbre qui en ont besoin sans passer par les props ? Grâce à la fonctionnalité de contexte de …

  10. useContext – React

    useContext는 전달한 Context 에 대한 Context Value 를 반환합니다. Context 값을 결정하기 위해 React는 컴포넌트 트리를 탐색하고 특정 Context에 대해 상위에서 가장 가까운 Context …

Refresh