history reactjs code example

Example 1: this.props.history.location.push

props.history.push({  pathname: '/register', state: data_you_need_to_pass});

Example 2: this.props.history.location.push

<Link to={{  pathname: "/register",  state: data_you_need_to_pass }}> Register</Link>

Example 3: history react router

history.push(
			`/product?make=${car_make_id}&model=${car_model_id}&year=${car_generation_id}&series=${car_serie_id}&engine=${car_trim_id}&variant=${car_equipment_id}`
		);

Example 4: history of react js

class ParentComponent extends React.Component {
  state = { color: 'green' };
  render() {
    return (
      <ChildComponent color={this.state.color} />
    );
  }
}