Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

React component not getting rendered properly

$
0
0

I'm trying to create a React app where I have two components:

  1. (placed on the left)
  2. (should take the remaining space on the right)

I want to use Flexbox to align both components horizontally, but for some reason:A. Sidebar appears, but Main is not rendering correctlyB. Flexbox styles don’t seem to applyWhy is my component not rendering properly, and how can I correctly use Flexbox to align these components side by side?CODE SNIPPETS:

  1. Main.jsx
import React from 'react'import './Main.css'const Main = () => {  return (<div>        hello world</div>  )}export default  Main 
  1. App.jsx
import React from 'react'import Sidebar from './components/Sidebar'import Main from './components/Main'import Special from './components/special'const App = () => {  return (<><div className='star'><Main/><Sidebar/><Special/></div></>  )}export default App
  1. index.css
*{  padding: 0;  margin: 0;  box-sizing: border-box;  font-family: serif;}body{  min-height: 100vh;  display: flex;}

Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>