the tabs are not showing content, here is the code. how can i solve this?
what am i doing wrong?
this code is almost similar to the one on react-bootstrap page
//simple tabs.js
import React, {Component} from 'react';
import {Tabs, Tab} from 'react-bootstrap';
import TabItem from './TabItem';
import data from './data'
class SimpleTabs extends Component{
constructor(props){
super(props);
this.state = {
key: 1 | props.activeKey
}
this.handleSelect = this.handleSelect.bind(this);
}
handleSelect (key) {
console.log("selected " + key);
this.setState({key})
}
render(){
return (
<Tabs
activeKey={this.state.key}
onSelect={this.handleSelect}
id="controlled-tab-example"
>
<Tab eventKey={1} title="Tab 1">
Tab 1 content
</Tab>
<Tab eventKey={2} title="Tab 2">
Tab 2 content
</Tab>
<Tab eventKey={3} title="Tab 3">
Tab 3 content
</Tab>
</Tabs>
);
}
}
export default SimpleTabs;
// App.js
import React, { Component } from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import SimpleTabs from './components/SimpleTabs';
import 'bootstrap/dist/js/bootstrap.bundle.min';
import 'bootstrap/dist/css/bootstrap.css'
class App extends Component {
render() {
return (
<SimpleTabs />
);
}
}
export default App;
page on web
I do need help to keep moving forward
The problem is your css isn't loading for the bootstrap components. If you add this in the header of your index.html where your serving your React app it should look correct. I see that you are trying to add the min.css to the App. Not sure why that isn't working, but this will work.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With