Why can't i see any output?

Above is the link of codesandbox…
Can anyone tell me pls why can’t i see any output here ???

Hi,

You missed a index.js file : https://codesandbox.io/s/random-quote-machine-yu9m9.

The ReactDOM.render() has to be called in your index.js, and your App component needs to be exported from your App.js.

Thank you very much.
The ReactDOM.render() has to be called in your index.js, and your App component needs to be exported from your App.js

Is this mandatory ?? Is it a convention that i should follow ??

I think the react-scripts in your package.json needs an index.js, I guess this is the entrypoint of your application.
I based myself on the structure created by the create-react-app scripts (https://create-react-app.dev/).

It’s a convention, but the tests need it to be followed since it has no way of checking otherwise. My usual convention otherwise is for the entry point to be app.js, and I don’t use index.js except for directory-based modules (my projects use hand-rolled webpack, so I can’t remember what CRA’s default is)

1 Like