14
loading...
This website collects cookies to deliver better user experience
.env
(dot env) file in your project folder and add HTTPS=true
inside it like this:HTTPS=true
yarn start
or npm start
command and now your entire application will be served on HTTPS.import { login } from '../actions/login';
import profileReducer from '../reducers/profile';
jsconfig.json
in your project folder and add the following code inside it:{
"compilerOptions": {
"baseUrl": "./src"
}
}
import { login } from 'actions/login';
import profileReducer from 'reducers/profile';
src
as a base URL now, so we only need to specify the folder path starting inside the src
folder as we've done in the above code..env
(dot env) file and declare the environment variable inside it like this:REACT_APP_API_BASE_URL=environment_variable_value
REACT_APP_PASSWORD=your_password
REACT_APP_
so create-react-app will be able to read it..env
file with your variables, it will be available in your React app inside the process.env
object.process.env.REACT_APP_API_BASE_URL
process.env.REACT_APP_PASSWORD
.env
file to your git repository for privacy reasons so make sure to add the .env
entry in your .gitignore
file.