I enjoyed your video and I’m surprised you don’t have more views ❤
@akay64x2
6 ай бұрын
Thanks! This was super useful.
@nikitaalekseev991
Жыл бұрын
Thank you! This is great explanation and trick! But wouldn't this be unsafe due window object is available from DevTools console? Can we pass some secret keys this way?
@jayfreestone
Жыл бұрын
Thanks! Definitely can't pass true 'secrets' this way, everything you pass is available on the client. A common pattern you'll see with isomorphic apps is separating out server and client config, i.e. true 'secret's and env vars which are just configuration. Sometimes there's a weird middle ground, like Google Maps API keys, but often these are not really *secret* since they're domain restricted. But yes, be very careful not to include real secrets! If you need a secret, you'll need a server.
@nikitaalekseev991
Жыл бұрын
@@jayfreestone Thank you for such thorough answer!
@iKlalter
Жыл бұрын
This is exactly what I was looking for and explained very clearly. Thanks a lot!
@dalthonmh
Жыл бұрын
How could I pass an env like process.env.REACT_APP_BASE_PATH where is the backend url service
@jayfreestone
Жыл бұрын
You should be able to follow the approach in the video: mount a JS file which sets the variables on the window. In the mounted file you’d manually set/hardcode the variable value, rather than reference an env var using process.env.
Пікірлер