This package is for navigate the data in React JS, React Native.
This package is for send data from one component to other in React JS.
This package is mainly for beginner of React developement.
This help you to navigate through components with some data.
All you need to do is one React project.
Create some components where you want to navigate data in React.
- Install react-data-navigation
npm i react-data-navigation --save
- You just need to import the DataNavigation class in your components.
- Import the DataNavigation class in your componet where you want to use this package
Now you can use the package's methods.
import { DataNavigation } from 'react-data-navigation';
.
.
.
// For set the data you need to call setData(key, value) Function i.e.
// eg. DataNavigation.setData('name', 'Viren');
// it will set the 'Viren' as respect to 'name' key.
import { DataNavigation } from 'react-data-navigation';
.
.
.
// Here we want to get the name value, which you set in home component than
// console.log('Hey my name is' + DataNavigation.getData('name'));
// it will print in console : Hey my name is Viren.
- getData(key) : method
It will return the value of data object - getWholeData() : method
It will give the whole data object - removeData(key) : method
It will delete the data in data object. - setData(key, value) : method
It will set the value in the object with key.
Source code can be found on github
Developed by Virendra Yadav