Markdown Previewer-React (thinking about efficiency with components)

Hello fellow Campers,

I have just finished my first React project on Markdown Previewer. Link to my code is :

I would love to hear everyone’s feedback on my project and ways I can improve my project.

I have a question regarding efficiency with React components. Is it better to divide a React component into multiple parts? Does that give more efficiency to my code? Or having just one main component is better for efficiency?

Thank you :smiley_cat:

For this particular app, one main component is fine.

The main reason for breaking apps up into lots of components is for the ease of development and reusability.

One extremely large component that was thousands of lines longer is harder to work with than the same app split into 20 discrete components.

Part of the reason it is easier is because working in a 200 line file is far more pleasant than working in a 2000 line file.

Another reason is because its easier to keep track of the component’s state when the component is responsible for one thing. State management is crucial in React, and the simpler you can make that for yourself, the better!

1 Like

Thank you for providing information on importance of multiple components, it makes more sense now.