dotenv

.env

Create .env file in the root folder

REACT_APP_

// Some code
REACT_APP_CLOUDFLARE_APIKEY1=xxx
REACT_APP_CLOUDFLARE_APIKEY2=yyy

APP.JS

timport { Box, Text } from "@chakra-ui/react";

function App() {
  
  const API1 = process.env.REACT_APP_CLOUDFLARE_APIKEY1;
  const API2 = process.env.REACT_APP_CLOUDFLARE_APIKEY2;

  return (
    <Box width='300px'>
      <Text> Your APIKEY#1 = {API1} </Text>
      <Text> Your APIKEY#2 = {API2} </Text>
    </Box>
  );
}

export default App;

.gitignore

Makre sure to put .env in your gitignore

.env

Last updated

Was this helpful?