I have question about how to reset the imported js file when user click on the back button and click forward button.
So for example
a.js file (where it will display the data) will import getData function data.js file. data.js file will send the data to the a.js file.
Example data for data.js file below
const data = [
{
id: "bee"
bool: true
},
{
id: "spider"
bool: false
}
]
const getData = () => {
const tempData = data;
// do the logic here and return
return tempData;
}
export default {
getData
};
so lets say I change the data from the a.js file using the getData function after importing the data.js file. The data still holds the previous data. So if I change the id spider bool to true, it will still holds the value of true when user clicks on the back button and comeback to the page again with forward button.
I tried to do the useeffect to reset the data but that did not work... Is there a way to reset the data.js file?