Answer the question
In order to leave comments, you need to log in
How to call the component's redux functionality?
There is a code:
addTodo.js
import PropTypes from "prop-types";
import { connect } from "react-redux";
import actions from "../../actions";
function addTodo (props) {
window.console.log('hey');
}
addTodo.propTypes = {
firstData: PropTypes.string,
secondData: PropTypes.object,
thirdData: PropTypes.array,
setFirstData: PropTypes.func,
};
const mapStateToProps = (store) => {
return {
firstData: store.firstData.data,
secondData: store.secondData.data,
thirdData: store.thirdData.data,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setFirstData: (data) => dispatch(actions.setFirstData(data)),
};
};
export default connect(mapStateToProps, mapDispatchToProps)(addTodo);
import React from "react"
import PropTypes from "prop-types";
import { connect } from "react-redux";
import actions from "../../actions";
import addTodo from "./addTodo"
function addTodoInputBtn(props) {
return (
<form onSubmit={ КАК ПРАВИЛЬНО ЗАПИСАТЬ ВЫЗОВ ЗДЕСЬ } className="todo_block-add_todo add_todo_block">
......................
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question