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
Post a Comment