DEV Community 👩‍💻👨‍💻

Chris Connelly
Chris Connelly

Posted on

Using .ENV to Hide Your Air Table Credentials In React

Create a dotenv file

First you'll want to create a .env file

Enter fullscreen mode Exit fullscreen mode

Install dotenv

Once you have this created you can use it by installing dotenv

npm -i dotenv
Enter fullscreen mode Exit fullscreen mode

Set up dotenv in airtable.js

var Airtable = require('airtable');
var base = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY }).base(
const table = base(process.env.AIRTABLE_TABLE_NAME);

module.exports = { table };
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!