mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 22:39:41 +08:00
Fix wrong param name in the guides (#911)
The text used `name` as param but the examples used `user` instead.
This commit is contained in:
committed by
Eric Vicenti
parent
e402eba3a7
commit
2a050da960
@@ -126,7 +126,7 @@ first-navigation
|
||||
|
||||
Hardcoding a name into the `ChatScreen` isn't ideal. It'd be more useful if we could pass a name to be rendered instead, so let's do that.
|
||||
|
||||
In addition to specifying the target `routeName` in the navigate function, we can pass params that will be put into the new route. First, we'll edit our `HomeScreen` component to pass a `name` param into the route.
|
||||
In addition to specifying the target `routeName` in the navigate function, we can pass params that will be put into the new route. First, we'll edit our `HomeScreen` component to pass a `user` param into the route.
|
||||
|
||||
```js
|
||||
class HomeScreen extends React.Component {
|
||||
@@ -148,7 +148,7 @@ class HomeScreen extends React.Component {
|
||||
}
|
||||
```
|
||||
|
||||
We can then edit our `ChatScreen` component to display the `name` param that was passed in through the route:
|
||||
We can then edit our `ChatScreen` component to display the `user` param that was passed in through the route:
|
||||
|
||||
```js
|
||||
class ChatScreen extends React.Component {
|
||||
@@ -168,7 +168,7 @@ class ChatScreen extends React.Component {
|
||||
}
|
||||
```
|
||||
|
||||
Now you can see the name when you navigate to the Chat screen. Try changing the `name` param in `HomeScreen` and see what happens!
|
||||
Now you can see the name when you navigate to the Chat screen. Try changing the `user` param in `HomeScreen` and see what happens!
|
||||
|
||||
```phone-example
|
||||
first-navigation
|
||||
|
||||
Reference in New Issue
Block a user