Closed trevor-ryan-burkholder closed 6 years ago
You don't need to use ui-router/redux
to achieve this, unless I'm missing something.
You can read the params via the transition
prop that is injected in the routed component like this:
render () {
const params = this.props.transition.params();
return (
<div>
{todos.filter(todo => todo.status === params.status).map(todo => (
<Todo data={todo} key={todo.id} />
))}
</div>
);
}
Thanks! I'll give this a try. I wasn't sure if the transition prop was only necessary if you were doing animations.
Yeah, the transition
prop refers to the router transition and not animations of any kind
Can we get an example of how to use a route parameter to filter props in a component? e.g. filter todos by whether they're completed or not?
Or would the ui-router/react examples suffice for this?