score:0

Accepted answer

pass it something like this. use state prop and pass necessary items. in the below example visibleflag which is a boolean is passed along the link.

 <link to={{
       pathname: '/client',
       state: {
                visibleflag: true
        }
  }}>
                   <button
                     onchange={(event) =>{
                       event.preventdefault();
                       this.setstate({
                           bvalue:"unavailable",
                           disable:true
                       })
                     disabled={this.state.disable}
                   >book now</button>
</link>

accessing:

const { visibleflag } = this.props.location.state

using withrouter hoc to access the router props

import { withrouter } from 'react-router-dom'
....
//code 
....
export default withrouter(yourcomponent)

score:0

you can pass state/props to other components using link

<link to={{
  pathname: '/client',
  state: {
    flag: true
  }
}}>client</link>

and in target component that will render

const { flag } = this.props.location.state;

if functional component

const { flag } = props.location.state

Related Query

More Query from same tag