score:2

it can be done when you replace state with data.

<link 
       to={{
       pathname: '/popular',
         data:{
            testfavorite: this.testfavorite
         }
       }}>

also replace here

this.props.location.state.testfavorite();

meanwhile, if you also want to pass data as props you can use state along with data


Related Query

More Query from same tag