ReduxCasts
ReduxCasts copied to clipboard
fix new post connect to state
Hello, after attempting to apply initial values to a redux form I've noticed that it didn't work when I've followed the new post example. The problem was the order in which the components were wrapped.
First we need to wrap the Form component with reduxForm and then connect it to the redux store.
export default reduxForm({ validate, form: "PostsNewForm" })(connect(null, { createPost })(PostsNew));
should be
export default connect(null, { createPost })( reduxForm({ validate, form: "PostsNewForm" })(PostsNew));
Hey, Check out the Redux Form docs for how they initialize values. Docs
The docs: connect()(reduxForm()(Form))
The course code had: reduxForm()(connect()(Form))