0
const data = [
    { id: 1, name: 'Ford', color: 'Red' },
    { id: 2, name: 'Hyundai', color: 'Blue' },
    { id: 3, name: 'Hyundai', color: 'Blue' },
];
const routeChange = () => {
    navigate.push(`/newclaimreview`);
  };

Here I am navigating to newclaimreview screen upon clicking a button. How to pass data as a parameter and how to receive data in newclaimreview screen

Drew Reese
  • 165,259
  • 14
  • 153
  • 181

1 Answers1

0

You can pass data using state parameters from one screen to another screen like that.

navigate.push({
  pathname: '/newclaimreview',
  state: data_you_need_to_pass
});

You get params which you have sent in next screen

import { useLocation } from "react-router-dom";
const location = useLocation();
console.log(location.state);
sedhal
  • 522
  • 4
  • 13