Spacing and Margin Utility in React-Bootstrap

pooja picture pooja · Dec 13, 2018 · Viewed 21.9k times · Source

I am React Js beginner. Are there spacing and margin utility classes in React Bootstrap like we have in Bootstrap mt-4,p-5,mx-auto etc. I am going through the documentation of react-bootstrap, also searched on many platforms but couldn't find the right answer. Just want to know if they exist.

Answer

Tony Bui picture Tony Bui · Dec 13, 2018

You can use Bootstrap, just add the class of Bootstrap to the component and it will work like normal. For example for component Header:

class Header extends React.Component {
 <div className='mt-5'> //margin-top 5px

 {..content here}
 </div>
}

Remember to add the Bootstrap to your project at index.html file

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">