Why can't operate with the standard props of a store'?

Added this state to the processor :

export default combineReducers({
 userIdea: inputIdeaReducer, //works
 ideas: renderIdeas, //works
 isInputActive: false //not working
});


in the component :

mapStateToProps function(state) {
 return {
 userIdea: state.userIdea,
 ideas: state.ideas,
 isInputActive: state.isInputActive
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);


and use the same component :

<input type="text" onchange="{this.inputChangeHandle}" placeholder="Type some text" value="{this.props.userIdea}">

 inputChangeHandle = e => {
 let value = e.target.value;
console.log(this.props.isInputActive);
 };


Gives undefined. Why?
Want to change the state to true/falls in zavisimosti from text input
June 10th 19 at 15:41
1 answer
June 10th 19 at 15:43
Solution
combineReducers takes as input an object with the functions of the following form:
(state: S, action: A) => S
and you pass a boolean.

Create isInputActive function reducer, something like
const isInputActiveReducer = (state = false, action) => {
 const { payload type } = action;

 switch(type) {
 case TOGGLE_INPUT:
 return payload;
default:
 return state;
}
}


But generally convey the state of the input in the store was a bad idea. This is more than enough state of the component.
Thank you, and it is practiced to use state of the component, if there is Redux? - krista.Eichma commented on June 10th 19 at 15:46
of course. Even as practiced. And component status(open, hidden, active) it just that case when to use state of the component. As often used state parent, with a transmission condition and colback for his changes to the child component(pagination, sorting, condition of forms, filtering). Close store good to store entities retrieved from the server and condition related isLoading, isError, all global settings, rights, user data and all other statics come from the server. Here in a nutshell not tell, of course. A necessary practice. Still good to analyze examples of good code. - Lenny.Botsfo commented on June 10th 19 at 15:49

Find more questions by tags ReactRedux