1

Can we include one or more self closing components in one main App.js file in reactjs

  1. I just created one react app i just wanted to include one more in one file(self closing component thing) means i created one component card.js and after that i included that component in main(App.js) file can i include another navbar.js component in that file .i did that but not showing anything it showing as it is means previous component things displays but another second file component not showing why this happening .?? images for detailing i think i need Router
krishna kakade
  • 429
  • 1
  • 6
  • 17
  • Does this answer your question?https://stackoverflow.com/questions/30373343/reactjs-component-names-must-begin-with-capital-letters – keikai Mar 27 '20 at 09:23

2 Answers2

2

You component needs to be rendered in a way that their names start with first letter as uppercase. You can have as many self closing elements as you want within a component

import Social from './components/social';
function App() {
  return (
     <div>
       <Jumbotron />
       <Social />
     </div>
  )
}
Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400
1

Try with a capital letter, otherwise the component will not be rendered correctly, as Shubham Khatri has shown in the example

ShrewdStyle
  • 500
  • 2
  • 5
  • 14