> For the complete documentation index, see [llms.txt](https://bluebase.gitbook.io/core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bluebase.gitbook.io/core/tutorial/2.-create-screens/3.2-edit-task-screen.md).

# 3.2 Edit Task Screen

Next up, we are going to create a screen that will allow a user to edit a task.

### Step 1: New Screens

Before we move forward to adding new routes, let's quickly create 3 copies of our `PendingTasksScreen` component, and give them the following names:

* CreateTaskScreen
* EditTaskScreen
* CompletedTasksScreen

So now we should have 4 screens in total.

### Step 2: Adding Edit Route

Add the following `EditTask` route to the `routes` array:

{% code title="src/index.ts" %}

```typescript
routes: [{
	name: 'EditTask',
	screen: 'EditTaskScreen',
	path: 't/:taskId',
	exact: true,

	options: {
		title: 'Edit Task',
	},
},
{
	name: 'TasksApp',
	screen: 'PendingTasksScreen',
	path: '',
	exact: false,

	options: {
		title: 'My Tasks',
	},
}]
```

{% endcode %}

This should create the second route, which should be accessible via the following URL:

```
http://localhost:19006/p/tasks/t/123
```

### Step 3: Create a Button to Navigate

But we still need a way to navigate to this route in our UI. Let's modify our `PendingTasksScreen` component to add a button:

```typescript
import { Button, View } from '@bluebase/components';
import { useNavigation } from '@bluebase/core';
import React, { useCallback } from 'react';
import { Text } from 'react-native';

export const PendingTasksScreen = () => {
	const { push } = useNavigation();

	const goToEdit = useCallback(() => {
		push('EditTask', { taskId: '123' });
	}, []);

	return (
		<View>
			<Text>PendingTasksScreen</Text>
			<Button title="Go To Edit Screen" onPress={goToEdit} />
		</View>
	);
};

PendingTasksScreen.displayName = 'PendingTasksScreen';
```

Notice, that we use the `push` method from BlueBase's `useNavigation` hook. The method takes route name and optional params object as its arguments.

Run your app, you should now be able to navigate between routes.

![](https://3369392052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPjsIbS1DfhqT8BS3Ui%2Fuploads%2FWkcnRq6tNsZwtl9CNP9O%2Fezgif-4-278ac5476b.gif?alt=media\&token=31ba789a-deae-4142-be4f-f63607ad30f3) ![](https://3369392052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPjsIbS1DfhqT8BS3Ui%2Fuploads%2FLESVtJJXZv5Rz5HFU0Hr%2Fezgif-4-ee022529d4.gif?alt=media\&token=cb28814d-5590-459d-9607-54a7a72ae4f8)

### Step 4: Extract Route Param

Notice that the value of path property in the route is `:taskId`. This means that any value that is entered in this part of the URL will be captured in the `taskId` param. For example the URL `http://localhost:19006/p/tasks/123` will extract value `123` in the `taskId` variable.&#x20;

Let's see how we can use this value, modify the `EditTaskScreen` component to match the following content:

{% code title="src/screens/EditTaskScreen/EditTaskScreen.tsx" %}

```typescript
import { useNavigation } from '@bluebase/core';
import React from 'react';
import { Text, View } from 'react-native';

export const EditTaskScreen = () => {
	const { getParam } = useNavigation();
	const taskId = getParam('taskId', null);

	return (
		<View style={{ padding: 10 }}>
			<Text>EditTaskScreen: {taskId}</Text>
		</View>
	);
};

EditTaskScreen.displayName = 'EditTaskScreen';
```

{% endcode %}

Notice the code on Line 7, we use the `getParam` function to extract the URL param.

![](https://3369392052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPjsIbS1DfhqT8BS3Ui%2Fuploads%2FcMMbzdjHyGUycIy0Wcxg%2FScreenshot%202022-04-22%20at%2010.46.59%20PM.png?alt=media\&token=016bebd5-15be-4397-aa7b-d3fd809724fc) ![](https://3369392052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPjsIbS1DfhqT8BS3Ui%2Fuploads%2Fx7w4orJOb25y77kjVa9v%2FScreenshot%202022-04-22%20at%2010.47.02%20PM.png?alt=media\&token=7852d230-fce9-4287-b5a0-05f6b017b847)
