React Native

React Native State Management

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

24 preguntas de entrevista·
Mid-Level
1

Which React hook allows consuming a value from a Context?

Respuesta

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?

Respuesta

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?

Respuesta

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 preguntas de entrevista

Domina React Native para tu próxima entrevista

Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.

Empieza gratis