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

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