0

i am storing values into three different variable.

const companyValue = useSelector((state) => state.changeCompanyReducer.company);
const selectionValueArray = Object.values(companyValue);
const companyCode = selectionValueArray[0];
const employeeId = selectionValueArray[1];

i am getting 3 values from selectionValueArray , companyCode , employeeId .

i want to place whole code in one file and import all these three variable name anywhere i want so that i can get 3 different values.

How can i achieve this?Thanks.

1 Answers1

0

You can do something like this

export const companyValue = your value
export const selectionValueArray = some value

Now you have to import like

import {companyValue, selectionValueArray} from './yourfile'

This type of import and export is called named export and import.
Learn more about it here

Rohit Aggarwal
  • 1,048
  • 1
  • 14
  • 32