alan2207 / bulletproof-react

🛡️ ⚛️ A simple, scalable, and powerful architecture for building production ready React applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STRUCTURE - Where to store static data?

calumx opened this issue · comments

Sorry if this is covered in the docs, but I can't seem to find/work it out.

If I have a large, unchanging array of constants, where do I store this in the Bulletproof React structure? For example, a large list of options for a select menu that is used in several places throughout the app (so not appropriate to co-locate with the select component).

The best way is to create a constants folder in src folder and there you create a file like options.ts.

interface OptionInterface {
    [key: string]: string;
 }
export const Options: OptionInterface = {
    "male": "Male",
    "female": "Female",
    "other": "Other"
}