
//import routes from "./routes";
import { Link, withRouter, NavLink, useHistory } from "react-router-dom";
export default function App() {
console.log(this.props.data.data);
const [value1, setValue1] = useState(0);
const [value2, setValue2] = useState(0);
...}
This part of code in slider.js accessing data variable passed from last page, mentioned below
axios
.post(
"/get_spec_other",
{
selected_country: this.props.selectedCountry,
selected_disease: this.props.selectedDisease,
selected_drug: this.props.selectedDrugs,
},
{ headers: { "content-type": "application/json" } }
)
.then((res) => {
const SpecificationName = Array.from(res.data);
console.log(res.data);
this.props.history.push({pathname: '/slider', data: res.data});
alert(res.data);
This is where I am passing data to /slider, and opening slider.js .