Esrtou com este erro no console, mas a execução no backend acontece normalmente.
index.js:1 Warning: React does not recognize the
buscarRegimes
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasebuscarregimes
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Código antes
Import
import { buscarRegimes } from ‘…/…/…/…/…/…/reducers/acoes/LicitacaoAcoes’;
import axios from 'axios' const URL = `http://localhost:8080/pregao-presencial-api/licitacao/` export const buscarRegimes = () => { return (dispatch) => { axios.get(`${URL}regimes`) .then(resp => { dispatch({type: 'REGIMES', payload: resp.data}) } ) } }
const mapStateToProps = state => ({ regimes: state.licitacao.regimes, }) const mapDispatchToProps = dispatch => bindActionCreators({ buscarRegimes, }, dispatch ) export default connect(mapStateToProps, mapDispatchToProps)(FilterPregao)
Pelo que entendi, mudei tudo para buscarregimes, ai é mostrado outro erro no console, mas continua a funcionar.
Invalid value for prop
buscarregimes
on tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see https://fb.me/react-attribute-behavior
Código depois
import axios from 'axios' const URL = `http://localhost:8080/pregao-presencial-api/licitacao/` export const buscarregimes = () => { return (dispatch) => { axios.get(`${URL}regimes`) .then(resp => { dispatch({type: 'REGIMES', payload: resp.data}) } ) } }
Import
import { buscarregimes } from ‘…/…/…/…/…/…/reducers/acoes/LicitacaoAcoes’;
const mapStateToProps = state => ({ regimes: state.licitacao.regimes, }) const mapDispatchToProps = dispatch => bindActionCreators({ buscarregimes, }, dispatch ) export default connect(mapStateToProps, mapDispatchToProps)(FilterPregao)
Não entendi os erros.