Netlify.toml file configuration with React

Hey guys!

This is my first Netlify / Serverless project and I am a noob programmer :slight_smile:

I just want to double-check if I did things the right way.

I run a static site with a newsletter sign-up form and therefore needed to create a netlify.toml file.

My site is:

I created a react app using npx create-react-app.

My folder structure and my netlify.toml file look like this:

My Netlify Build Settings look like this:

Base directory
Not set

Build command
npm run build

Publish directory


The tutorial I have followed to create my sign-up form has used publish = "dist", which has caused my build to fail.

I went ahead and changed it to publish = "build/" and that has worked for me.

I just want to see if I do this correctly.

Thanks a lot for the help :slight_smile:

If it works, don’t touch it :joy:.

It usually depends on your needs and setup. In simple cases, there’s no need for the toml file as the build and publish directories can be directly set in the UI.

So, if everything is working as you’d expect it to, it’s correct.