Skip to content

Instantly share code, notes, and snippets.

Forked from gaearon/App.js
Last active February 20, 2020 10:15
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save eddywashere/e13033c0e655ab7cda995f8bc77ce40d to your computer and use it in GitHub Desktop.
Save eddywashere/e13033c0e655ab7cda995f8bc77ce40d to your computer and use it in GitHub Desktop.
Reactstrap App.js Example for create-react-app
import React, { Component } from 'react';
import {
} from 'reactstrap';
class App extends Component {
constructor(props) {
this.toggle = this.toggle.bind(this);
this.state = {
isOpen: false
toggle() {
isOpen: !this.state.isOpen
render() {
return (
<Navbar color="inverse" inverse toggleable>
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand href="/">reactstrap</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav className="ml-auto" navbar>
<NavLink href="/components/">Components</NavLink>
<NavLink href="">Github</NavLink>
<h1>Welcome to React</h1>
View Reactstrap Docs
export default App;
Copy link

wrunk commented Oct 21, 2017

Maybe worth noting this example didn't work for me with latest reactstrap. I did have luck using the example from components/navbar:

This had issues with the nav props and other errors that caused the page to not render properly.

Copy link

Working Typescript example for reactstrap-5.0.0-alpha.4

Copy link

I wasn't luck with neither the docs example nor the components/navbar. Here is an screenshot from the rendering of the navbar example:


Copy link

zaffkea commented Jan 3, 2018

@eddywashere, @rafaellehmkuhl, and @wrunk I think it isn't working because it's missing the .css. I added this line, and it works for me now.
import 'bootstrap/dist/css/bootstrap.css';

Copy link

Awsome! :D:D zaffkea . It is freaking working now. Thank YOU!!!

Copy link

I was unable to load the boostrapp.css file without adding some code to my webpack.config.js file. Perhaps it was because I was using webpack. The following link was helpful:

Copy link

@eddywashere The navbar color is wrong use <Navbar color="dark" inverse toggleable> instead <Navbar color="inverse" inverse toggleable>

Copy link

lizzymendivil commented Mar 28, 2018

Hi! Please, help me... I used to use bootstrap via CDN, you know, <link rel="stylesheet" href ... and <script src=""> etc
So, here, for react, where is the jquery, popper and bootstrap.min.js?
Sorry, it is my first time with react and npm. Thanks :)

Copy link

And also I have this error

Failed to compile.

Module not found: Can't resolve 'bootstrap/dist/css/bootstrap.min.css' in 'D:\React\my-app2\src'

Copy link

Can we use Col or Container on first line instead of div?

Copy link

aishbetu commented Sep 4, 2018

To all who're saying bootstrap.css not working. Just import the file at the very first line and it'll work See the example below
import 'bootstrap/dist/css/bootstrap.css';
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment