import React, { Component } from 'react'; import { withStyles } from '@material-ui/core/styles'; import PropTypes from 'prop-types'; import { CrudAveriaTab } from './table' import { Paper, Typography } from '@material-ui/core'; import { connect } from 'react-redux'; //actions import { getPedidos } from 'ba-actions/pedido'; const styles = ({ root: { flexGrow: 1, marginTop: 30, } }); class AveriaTab extends Component { constructor (props) { super(props) this.state = { dataRealF: [] }; this.props.dispatch(getPedidos()).then((res) => { if (res) { this.setState({ dataRealF: res.data, }); } }) } render() { const {dataRealF} = this.state; const { classes } = this.props; return ( ); } } AveriaTab.propTypes = { classes: PropTypes.object.isRequired, }; const reducer = 'pedido' const mapStateToProps = state => ({ force: state, // force state from reducer pedidosLista : state.getIn([reducer]), }); const mapDispatchToProps = dispatch => ({ dispatch }); const AveriaTabMapped = connect( mapStateToProps, mapDispatchToProps )(AveriaTab); export default withStyles(styles)(AveriaTabMapped);