[英]Changing the default main file "index.js" to some other file in react?
I have been thinking about the topic of changing the main file in react but I couldn't get through.我一直在想在react中更改主文件的主题,但我无法通过。 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如果它是 app.js 你可以更改任何文件以在 React 应用程序中呈现根 id div
If you want to change app.js you can change the following line in index.js file如果你想更改 app.js,你可以在index.js文件中更改以下行
ReactDOM.render(
<React.StrictMode>
<App /> // Change To Your Default File
</React.StrictMode>,
document.getElementById('root')
);
I assume you are referring to create-react-app.我假设您指的是 create-react-app。 In which case the answer is no: https://create-react-app.dev/docs/folder-structure .
在这种情况下,答案是否定的: 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.你总是可以弹出一个 create-react-app,但在我看来,这并不值得,除非你需要一些非常具体的配置。
Keep in mind that you don't have to use create-react-app to use react proper .请记住,您不必使用create-react-app来使用react proper 。 If you use react by itself, you can apply any organization you wish.
如果你单独使用 React,你可以应用任何你想要的组织。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.