Local state is data managed within a single component using hooks like useState. It affects only that component and its children.
Click to reveal answer
beginner
What problem does Context API solve in React Native?
Context API helps share data across many components without passing props manually at every level, useful for global settings like themes or user info.
Click to reveal answer
intermediate
How does Redux manage state differently than local state?
Redux stores all app state in a single global store. Components read state and dispatch actions to update it, making state predictable and easier to debug.
Click to reveal answer
intermediate
What is a key advantage of using Recoil for state management?
Recoil allows fine-grained state management with atoms and selectors, enabling components to subscribe only to the state they need, improving performance.
Click to reveal answer
beginner
When should you prefer local state over global state management?
Use local state when data is only relevant inside one component or a small part of the app to keep things simple and avoid unnecessary complexity.
Click to reveal answer
Which state management method is best for sharing theme settings across many components?
ARedux
BLocal state
CContext API
DComponent props only
✗ Incorrect
Context API is designed to share data like themes globally without prop drilling.
What is a main feature of Redux?
AState only inside one component
BSingle global store with actions
CAutomatic UI updates without actions
DNo need to write reducers
✗ Incorrect
Redux uses a single global store and actions to update state predictably.
Which hook is commonly used for local state in React Native?
AuseState
BuseEffect
CuseContext
DuseReducer
✗ Incorrect
useState is the basic hook for managing local state.
Recoil state management uses what to represent pieces of state?
AAtoms
BReducers
CProps
DContexts
✗ Incorrect
Recoil uses atoms to represent individual pieces of state.
When is it better to use local state instead of global state?
AWhen you want to use Redux
BWhen state is shared across many components
CWhen you want to avoid using hooks
DWhen state is only needed inside one component
✗ Incorrect
Local state is simpler and best when data is only relevant inside one component.
Explain the differences between local state, Context API, and Redux in React Native.
Think about how and where the state is stored and shared.
You got /3 concepts.
Describe a scenario where using Recoil would be more beneficial than Redux or Context API.
Consider how Recoil manages atoms and selectors.
You got /3 concepts.
Practice
(1/5)
1. Which React Native state management method is best for simple, local component state?
easy
A. Redux
B. useState
C. Context API
D. MobX
Solution
Step 1: Understand local state needs
Local state means data used only inside one component, like a toggle or input value.
Step 2: Match state method to simplicity
useState is designed for simple, local state inside functional components.
Final Answer:
useState -> Option B
Quick Check:
Simple local state = useState [OK]
Hint: Simple local state? Use useState hook [OK]
Common Mistakes:
Choosing Redux for simple local state
Confusing Context API with local state
Thinking MobX is simpler than useState
2. Which of the following is the correct syntax to declare a state variable using useState in React Native?