bulletproof-react icon indicating copy to clipboard operation
bulletproof-react copied to clipboard

STRUCTURE - Where to store static data?

Open calumx opened this issue 2 years ago • 1 comments
trafficstars

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).

calumx avatar Nov 01 '23 11:11 calumx

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"
}

shobhitk8055 avatar Mar 04 '24 10:03 shobhitk8055