So I'm working a React/Typescript project, where I need to store a value for the number of rows that needs to be accessible globally.
Is it a good idea to define it on the window object?
window.MySpace = {};
MySpace.rowCount = 10;
Are there any issues that could arise as the project grows? Or is there a more elegant way of handling this through Typescript?
Thanks!
edit:
Declare it as a module in a module.ts
file
export module Global {
export const rowCount = 10;
}
Then import it to whichever file requires the value of rowCount
.