OHHAKO / reatsby

React + Gatsby :smile:
https://ohhako.github.io/react-app/
1 stars 0 forks source link

style: use react-bootstrap instead of plain bootstrap #10

Closed kkyueing closed 4 years ago

kkyueing commented 4 years ago

I've just found react-bootstrap and it looks decent.

The project also looks quite healthy. It is used by 209k other projects according to github stats, and has over 300 contributors.

JSX with plain bootstrap look like this:

import React from 'react';

function Example()  {
  return (
    <div class="alert alert-danger alert-dismissible fade show" role="alert">
      <strong>Oh snap! You got an error!</strong> 
      <p> 
        Change this and that and try again.
      </p>
      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
        <span aria-hidden="true">&times;</span>
      </button>
    </div>
  )
}

Following snippet shows JSX with react-bootstrap:


import React, { Component } from 'react';
import Alert from 'react-bootstrap/Alert';

function Example() {
  return (
    <Alert dismissible variant="danger">
      <Alert.Heading>Oh snap! You got an error!</Alert.Heading>
      <p>
        Change this and that and try again.
      </p>
    </Alert>
  )
}

What do you think?

OHHAKO commented 4 years ago

It's looks good. By using just one line import Alert from 'react-bootstrap/Alert'; We can reduce the line of code and get intuitive expression also too.

kkyueing commented 4 years ago

Great. I'll create a PR and let you take a look at it.