Reputation: 50742
I am having a hard time debugging the issue, where it seems the Redux store is not getting connected to the React component. Below is the codesandbox link with the entire code;
https://codesandbox.io/s/crisil-tp7pv?file=/src/TestComponent.js
Really sorry, but I am unable to add the entire code here, as there are multiple boilerplate code/files.
Specifically, I am having issues inside the following function i.e. call to props.saveTask()
is not working OR props.actionCreator()
const stopTimer = () => {
clearInterval(timerId);
props.saveTask(task);
setTask((prevState) => {
return { ...prevState, timeField: 0 };
});
};
What might I be doing wrong?
Upvotes: 1
Views: 39
Reputation: 53884
You are importing the component instead of importing the CONNECTED component:
// The connected component is in default import
export default connect(null, { saveTask })(TestComponent);
// should be
import TestComponent from "./TestComponent";
// instead of
import { TestComponent } from "./TestComponent";
The same goes for TaskLists
.
Upvotes: 1