1. 14
    Redux: Fetching Data on Route Change
    3m 46s

Redux: Fetching Data on Route Change

Dan Abramov
InstructorDan Abramov

Share this video with your friends

Send Tweet

We will learn how to fire up an async request when the route changes.

Hang
Hang
~ 9 years ago

Would this following achieve the same thing with the same performance as the componentDidUpdate part? componentWillReceiveProps(nextProps) { if(this.props.filter !== nextProps.filter) { fetchTodos(nextProps.filter).then(todos => ...) } }

Federico Garcia
Federico Garcia
~ 8 years ago

Could you explain when to use componentWillReceiveProps and when componentDidUpdate? In every tutorial I see, people always use componentWillReceiveProps...

John
John
~ 7 years ago

Regarding the 'Link' component found within 'FilterLink', the 'All' link was not functioning. In order to get it to work I needed to have filter = '/' instead of an empty string when the conditional is true:

filter === 'all' ? '/' : filter (edited filter = '/')

Vs.

filter === 'all' ? '' : filter (original filter = '')

Link Component below,

Link to={filter === 'all' ? '/' : filter} activeStyle={{ textDecoration: 'none', color: 'black', }} > {children} Link

Srikanth  Dasari
Srikanth Dasari
~ 7 years ago

hi,

github link is broken, can you please add it?