How can the routing object of react-router be passed to pure components?


A>B>C 

A
this.props.paramslocation

C
C
cosnt C = (props) =>{
    return()
}

find a method that does not pass layer by layer, and make it available to all components globally

Mar.31,2021

this.$route try


the easiest way is:
you have got pathname .
so:

A = () => {
    <B pathname={this.props.params.pathname}/>
}

B = props => {
    <C pathname={props.pathname}/>
}

C = ({pathname}) => {
    //pathname
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4503a-6649f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4503a-6649f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?