React website template - purpose of the the PUBLIC and BUILD folders


I am new to React. I downloaded a free React website template from here www. creative-tim. com/product/paper-kit-react

When I opened the downloaded template archive I noticed there are 3 main folders: SRC, BUILD, PUBLIC

I know SRC folder is for raw assets (SCSS files, images, …) and components & views. I also know BUILD folder contains builded compiled and optimized SCSS & JS & images.

Where do I find a code that tells how and where should assets from SRC be compiled into BUILD? And what is the purpose of the PUBLIC folder?


If it’s built using create react app:

public/ is for stuff that doesn’t need compiling but needs the be present in the final built app and during development – for example, you don’t really need to compile HTML files, so the index.html can go there. You don’t compile favicons, so favicon.ico goes there.

build/ is the final built package of files that will be deployed somewhere. To build it, everything in public is copied across, and the JS (+ CSS etc) is compiled to a bundle or bundles which are also written to the folder.

There should be instructions in the README file; if not, there should be commands to run listed in package.json – I’d expect there to be a “start” (bundles everything up for development and opens a server locally so you can see browser) and “build” to build an end product.

1 Like