Arunkumar09
Arunkumar09

Reputation: 127

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. Please, Can anyone explain whether can we change, if not then why.

Upvotes: 2

Views: 7531

Answers (3)

David Sainez
David Sainez

Reputation: 6956

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.

Upvotes: 2

Ziadi Lotfi
Ziadi Lotfi

Reputation: 39

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')
);

Upvotes: 0

ram
ram

Reputation: 31

If it is app.js you can change any file to render a root id div in react app

Upvotes: 1

Related Questions