Question: How do I pass dynamic data to the Create React App-based template? #77

Closed
opened 2025-08-09 17:14:55 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @robfe on 5/3/2018

I'd like to pass a few environment-specific configuration variables to my client code (access keys to 3rd party services like raygun and auth0).

What's the best way to get these to the client? Ideally they'd be available on load, i'm looking for alternatives to making an AJAX API call to get these from the server.

I'm basically looking for https://github.com/aspnet/Docs/blob/master/aspnetcore/client-side/spa-services.md#the-asp-prerender-data-tag-helper, but working with the index.html file from CRA instead

I am not currently using server-side rendering.

I'm also interested to know if the CRA serviceworker has any implications on the solution here.

I've seen how CRA can make env variables from build available https://github.com/facebook/create-react-app/blob/v0.2.3/template/README.md#adding-custom-environment-variables - but can't tell how to get SPAServices to provide these, or if that's a good idea

*Originally created by @robfe on 5/3/2018* I'd like to pass a few environment-specific configuration variables to my client code (access keys to 3rd party services like raygun and auth0). What's the best way to get these to the client? Ideally they'd be available on load, i'm looking for alternatives to making an AJAX API call to get these from the server. I'm basically looking for https://github.com/aspnet/Docs/blob/master/aspnetcore/client-side/spa-services.md#the-asp-prerender-data-tag-helper, but working with the index.html file from CRA instead I am not currently using server-side rendering. I'm also interested to know if the CRA serviceworker has any implications on the solution here. I've seen how CRA can make env variables from build available https://github.com/facebook/create-react-app/blob/v0.2.3/template/README.md#adding-custom-environment-variables - but can't tell how to get SPAServices to provide these, or if that's a good idea
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#77
No description provided.