I have been thinking about the topic of changing the main file in react but I couldn't get through. Please, Can anyone explain whether can we change, if not then why.
If it is app.js you can change any file to render a root id div in react app
If you want to change app.js you can change the following line in index.js file
ReactDOM.render(
<React.StrictMode>
<App /> // Change To Your Default File
</React.StrictMode>,
document.getElementById('root')
);
I assume you are referring to create-react-app. In which case the answer is no: https://create-react-app.dev/docs/folder-structure .
You can always eject a create-react-app, but IMO it is not really worth it unless you need some really specific configuration.
Keep in mind that you don't have to use create-react-app to use react proper . If you use react by itself, you can apply any organization you wish.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.