this is my first time to develop a react application.
I am encountering difficulties when trying to retrieve the value of const from another component to another. If I import and export the component, I cannot access the value of the const.
Am I doing it incorrect? Are there any better approaches to dynamically update the axios get request that is triggered in button click from another component
Component 1 index.js
import Panel from "../TransactionPanel";
const getServerData = async ({ filters, sortBy, pageSize, pageIndex }) => {
await new Promise(resolve => setTimeout(resolve, 500));
//set the detail dynamically using the retrieved value from another component (checkedMap)
//can be also send the whole link
let detail = 111;
// Get our base data
const res = await axios.get(
"http://link_here/" +
detail +
"/details"
);
let rows = res.data;
This is where I get the value in another component using useState hook
Component 2 index.js
export default function({ infinite }) {
const [checkedMap, setCheckedMap] = useState(new Map());
Thank you very much for your help.