How to pass values or objects with link in react-router-native?

79 views Asked by At
            <Link
              to={{
                pathname: "/studentDetails",
                state: {
                  selectedStudent: studentsData,
                },
              }}
            >
              {basicData.studentName}
            </Link>
   

In the above code, it is the example for sending Objects with link in react.js using react-router-dom. And currently I'm developing a react native app and for that, I'm using react-router-native(https://reactrouter.com/native/guides/quick-start) as my router. And how to pass Objects with links using this NPM Package in react native

2

There are 2 answers

0
Aditya m On

Try this, im hoping basicData[] is your state array ,<Link to={{ pathname: "/studentDetails", state: { selectedStudent: basicData.studentsData, }, }} >

0
TalOrlanczyk On

can you show what this show you when you try to get the state cause as I know it should be the same