TheGabornator
TheGabornator

Reputation: 551

How to do onClick element change in Redux a container with React.js?

I already saw a similar question from someone else here and the answer is pretty clear. Yet, if you're working with in a redux container, the states turn into props through the mapStateToProps function.

How is it then correct to proceed if I want e.g. my text-div to turn into an input, when I click or double-click on it? I don't have any code yet, I'm wondering about the theory.

Upvotes: 1

Views: 413

Answers (1)

Chase DeAnda
Chase DeAnda

Reputation: 16441

The components get store state data passed in as props, but they can also have their own state. So in your case, your component would use it's own state to handle the toggling of div to input. If for some reason you wanted it to be saved in the store instead, you would fire off an action to toggle the view and then use the prop from the store in your render method.

Upvotes: 2

Related Questions