import React, { Component } from 'react'; import { withStyles } from '@material-ui/core/styles'; import PropTypes from 'prop-types'; import { AppBar, Tabs, Tab, Paper, Typography } from '@material-ui/core'; import { connect } from 'react-redux'; import CamionTab from './CamionTab/CamionTab'; import FlotaTab from './FlotaTab/FlotaTab'; import AveriaTab from './AveriaTab/AveriaTab'; //actions function TabContainer(props) { return ( {props.children} ); } TabContainer.propTypes = { children: PropTypes.node.isRequired, }; const styles = ({ root: { flexGrow: 1, marginTop: 30, } }); class CamionesMain extends Component { constructor (props) { super(props) this.state = { value: 0 }; } handleChange = (event, value) => { this.setState({ value }); }; render() { const {value} = this.state; const { classes } = this.props; return (
{`Camiones`}
{value === 0 && } {value === 1 && } {value === 2 && }
); } } CamionesMain.propTypes = { classes: PropTypes.object.isRequired, }; const reducer = 'pedido' const mapStateToProps = state => ({ force: state, // force state from reducer }); const mapDispatchToProps = dispatch => ({ dispatch }); const CamionesMainMapped = connect( mapStateToProps, mapDispatchToProps )(CamionesMain); export default withStyles(styles)(CamionesMainMapped);