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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -