javascript - accessing environment variable from react component -


i have non sensitive data need set different values based on environment node runs in staging or production, believe accessing process.env.node_env not work within react component itself, in server side files, hence need way somehow pass down react component.

it show if string "staging" or "production" inside footer component.

consider using defineplugin:

define free variables. useful having development builds debug logging or adding global constants.

example:

new webpack.defineplugin({     version: json.stringify("5fa3b9"),     browser_supports_html5: true,     two: "1+1",     "typeof window": json.stringify("object") }) 

Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -