React Native

React Native State Management

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

24 pytań z rozmów·
Mid-Level
1

Which React hook allows consuming a value from a Context?

Odpowiedź

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?

Odpowiedź

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?

Odpowiedź

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 pytań z rozmów

Opanuj React Native na następną rozmowę

Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.

Zacznij za darmo