If you need to declare a global variable in React, then you can do the following:

Create a file called config.js

1
2
3
4
5
6
7
8
module.exports = global.config = {
    something: {
        somethingelse: {
            amount: 123,
            name: "Andrew"
        }
    }
};

Then import the config file where you need it:

1
import './config';

Then where you need it in your code:

1
global.config.something.somethingelse.amount

or

1
global.config.something.somethingelse.name