Thuta Learning
React Native
ExercisesMobile DevelopmentIntermediate

Practice: State & Navigation Challenges

React NativeLesson 3240 min

What you'll walk away with

  • Explain the React and native-platform behavior of Practice: State & Navigation Challenges
  • Test accessibility, failure, and lifecycle cases
  • Write maintainable, testable, and performant React Native

Explain it simply

Practice: State & Navigation Challenges, in plain language

This practice set steps up the difficulty — these tasks require combining state management, side effects, and navigation all at once.

Problem → Why → Solution

The problem — why this concept matters

In Task 1, only changing the button's style for the disabled logic and forgetting to add the count < 10 check inside the actual onPress function

A common mistake

In Task 3, destructuring route.params without making sure the route prop is actually being passed into the component, causing an error

Core concept — understand how it works

Evaluate Practice: State & Navigation Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Mental model
  1. requirement
  2. reason and implement
  3. test and explain

Explain the React and native-platform behavior of Practice: State & Navigation Challenges

Core syntax or pattern

javascript
// Task 3 hint — passing data via route params
navigation.navigate('ScreenB', { name: inputValue });

// In ScreenB:
function ScreenB({ route }) {
  const { name } = route.params;
  return <Text>Hello, {name}!</Text>;
}

Evaluate Practice: State & Navigation Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Read the code step by step

  1. requirement// Task 3 hint — passing data via route params

    This practice set steps up the difficulty — these tasks require combining state management, side effects, and navigation all at once.

  2. reason and implementfunction ScreenB({ route }) {

    Evaluate Practice: State & Navigation Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

  3. test and explain}

    Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Execution flow
  1. requirement
  2. reason and implement
  3. test and explain

Success

Explain the React and native-platform behavior of Practice: State & Navigation Challenges

Failure

In Task 1, only changing the button's style for the disabled logic and forgetting to add the count < 10 check inside the actual onPress function

Let's think about it this way for a moment

This practice set steps up the difficulty — these tasks require combining state management, side effects, and navigation all at once.

Let's connect it to a real scenario

Three tasks: (1) Counter with limit — build a counter with useState, and add logic so the '+' button becomes disabled once count reaches 10; (2) Search + Navigation — search products by name with a TextInput, show the filtered results in a FlatList, and navigate to a Detail screen when an item is pressed; (3) Multi-screen form — type a name on Screen A, press 'Next' to move to Screen B while passing the data with navigation.navigate('ScreenB', { name }), then display route.params.name on Screen B.

Code Example

javascript
// Task 3 hint — passing data via route params
navigation.navigate('ScreenB', { name: inputValue });

// In ScreenB:
function ScreenB({ route }) {
  const { name } = route.params;
  return <Text>Hello, {name}!</Text>;
}
You should see
You'll finish all three tasks with an interactive, navigable screen.

5-Minute Try-It

Implement the three tasks yourself — Task 3 (route params) may be the toughest, so it's fine to go back and review the React Navigation lesson if you need to.

A Quick Word of Caution

Task 3's route params update when the screen gets re-mounted (i.e., when you call navigate again) — calling goBack() and then navigating back in behaves differently from pushing new params onto an existing screen, so make sure you can tell the two apart.

Real-world usage

How to apply it in a real project

Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Mini challenge

Build it yourself

Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

  • Rebuild the example without copying it
  • Test a normal input and an edge case
  • Predict the compiler or output result before running it
javascript
// Task 3 hint — passing data via route params
navigation.navigate('ScreenB', { name: inputValue });

// In ScreenB:
function ScreenB({ route }) {
  const { name } = route.params;
  return <Text>Hello, {name}!</Text>;
}

Expected: Explain the React and native-platform behavior of Practice: State & Navigation Challenges

Show hint

Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Quick quiz 1 / 3

What best describes the core idea of Practice: State & Navigation Challenges?

Quick quiz 2 / 3

Which mistake should you avoid first?

Quick quiz 3 / 3

How should this be applied in a real project?

What to remember

  • requirement → reason and implement → test and explain
  • Evaluate Practice: State & Navigation Challenges on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.
  • In Task 1, only changing the button's style for the disabled logic and forgetting to add the count < 10 check inside the actual onPress function
  • Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

React Native Documentation — React Native

Easy traps

  • In Task 1, only changing the button's style for the disabled logic and forgetting to add the count < 10 check inside the actual onPress function
  • In Task 3, destructuring route.params without making sure the route prop is actually being passed into the component, causing an error
  • Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.

Hands-on Exercise

Test an original Practice: State & Navigation Challenges example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

You'll know it worked when: You'll finish all three tasks with an interactive, navigable screen.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Practice: State & Navigation Challenges | Thuta Learning