Redux question concerning extract local state into redux

Hi. I’m fairly new to React and Redux.

Extract Local State into Redux

I’m getting held up on the last two completion requirements. It appears to be some fundamental flaw in my syntax, possibly? I’ve not had a ton of problems up until this point, so I’m not sure why I’m really stuck on this, lol.

submitMessage() {
const curMsg = this.state.input;
this.setState ( { input: ‘’ });
this.props = {
// messages: this.state.messages.concat(this.state.input)
messages: // not sure how to make this work

Is anyone able to help me?

So you’ve got the first part right – you want to use the state’s input in submitMessage. The next part, stating to use submitNewMessage() from this.props is where you’re running into problems. Note that submitNewMessage() is a function from props (see the mapDispatchStateToProps around line 75). So, the way you’re supposed to call this is just: this.props.submitNewMessage(message) – where, instead of message, you’d use curMsg.


You know what!?!?! Thanks to you and like way too much time on this problem, honestly, I have some issues at times spotting errors in what I am coding, like where objects are originating from, how javascript sees them, and what kind of dereferencing it requires as well as some minor scoping confusing here and there. I can say after not really having attempted to really pick the language up, i am making alot more progress in the past few days than, for, like ever. Thank you so much for your assistance Isurasani :star_struck:

React and Redux have been a bit of a challenge for me to get right.

1 Like