React Native

React Native State Management

Context API, Redux Toolkit, Zustand, Recoil, state patterns, global state

24 面接問題·
Mid-Level
1

Which React hook allows consuming a value from a Context?

回答

useContext is the dedicated hook for consuming values from a Context. It takes the Context object created with createContext as a parameter and returns the current value provided by the nearest Provider in the component tree. This is the modern and recommended way to access contextual data in functional components.

2

Which function should be used to create a Context in React?

回答

createContext is the function provided by React to create a new Context object. This function accepts an optional default value that will only be used when a component consumes the Context without having a corresponding parent Provider. The returned object contains two properties: Provider and Consumer.

3

What is the main drawback of Context API for global state management?

回答

Context API causes a re-render of all consumer components when the Context value changes, even if the component only uses part of that value. This behavior can cause significant performance issues in applications with many consumers or frequent global state updates.

4

What is the name of the Redux Toolkit function used to create a state slice?

5

Which state management library uses direct mutation syntax while remaining immutable under the hood?

+21 面接問題

次の面接に向けてReact Nativeをマスター

すべての問題、flashcards、技術テスト、コードレビュー演習、面接シミュレーターにアクセス。

無料で始める