Lee
Lee

Reputation: 41

How to pass redux props and navigation parameters together?

I have successfully passed react native navigation parameters as follows:

PageOne = ({ navigation, route }) => {
const { itemId, otherParam } = route.params;
...
}

And I have done passing redux props to use redux actions as follows:

PageTwo = (props) => {

}

How can I put the parameters and the props together into a component?

Your help will be highly appreciated!

Upvotes: 0

Views: 344

Answers (2)

hasankzl
hasankzl

Reputation: 1019

you can combine them like:

PageOne = ({ navigation, route, reduxParam1,reduxParam2 }) => {
const { itemId, otherParam } = route.params;
}

or you can use like this too

PageOne = (props) => {
const { itemId, otherParam } = props.route.params;
}

Upvotes: 1

Nikhil bhatia
Nikhil bhatia

Reputation: 1397

this should work

Page = (props) => {
const { navigation, route } = props
const { itemId, otherParam } = route.params;
...
}

Upvotes: 1

Related Questions