Create React App generates a static html we use to bind our components to. I am wondering if we could change contents based on the environment we are in.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<div id="root"></div>
</body>
For example, if can I have title as "develop" & "production" depending on where the react app is running?
Can this be achieved just using reactjs env config file without any server side rendering?
edit: ...and without ejecting and dealing with webpack config?
titletag you can use Helmet github.com/nfl/react-helmetenvfile and reference that in your title like so: <title>%REACT_APP_MY_PAGE_TITLE%</title> This way you can define different titles for different envs likeenv.local,env.productione.t.c This was so neat, i hope it helps you