React | Pass Redux state with create selector and hide menu item












1















In the React Component that handles the Sidebar, we have the Menu Items, as modules. I want to pass a specific state from Redux, and in the case of false hide a specific item.
I did it but with passing the state as Props with componentWillRecieveProps. But I need to do it specifically with createSelector from reselect, as componentWillRecieveProps is gonna be deprecated and we are starting to using reselect more and more.



Problem is I have no idea how to do that. The reselect docs are more confusing than helping. So can you help a little?



Component:



import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createSelector } from 'reselect';

import { isRouteActive } from './location';

class ModuleNavigation extends Component {
static propTypes = {
modules: PropTypes.array,
user: PropTypes.object,
currentRoute: PropTypes.string,
isMinimized: PropTypes.bool,
isItAvailable: PropTypes.bool,
}

state = {
isOpen: false,
}

constructor(props) {
super(props);

this.topNavRef = React.createRef();
this.bottomNavRef = React.createRef();
this.moduleNavRef = React.createRef();
}

componentDidUpdate() {
this.updateArrows();
}

componentDidMount() {
this.updateArrows();
window.addEventListener('resize', this.updateArrows);
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateArrows);
}

onToggle = () => {
this.setState({ isOpen: !this.state.isOpen });
}

getRefId = (index) => {
if (index === 0) return this.topNavRef;
if (this.props.modules && index === this.props.modules.length - 1) return this.bottomNavRef;

return null;
}

renderGroup = (group, index, user, currentRoute, isMinimized) => (
<ul ref={this.getRefId(index)} key={group.name} className="module-navigation-group nav">
{
<li className={classNames('mt-10 mb-10 module-navigation-group-separator', { hidden: index === 0 })} />
}
{group.children
.filter(mod =>
mod.route && (!mod.permissions || userHasPermission(user, mod.permissions)))
.map(mod =>
(<li key={mod.name} className={classNames('module-navigation-group-item', { active: isRouteActive(currentRoute, mod.route) })}>
<a href={(mod.parentApp ? '#' : '') + mod.route} target={mod.target} title={mod.name}>
<i className={`fa ${mod.classNames} module-navigation-group-item-icon`} />
{!isMinimized && <span className="hidden-xs hidden-sm ml-15 module-navigation-group-item-label">{mod.name}</span>}
</a>
</li>))}
</ul>
)

render() {
const {
modules,
currentRoute,
user,
isItAvailable,
} = this.props;

if (!user || !modules || !modules.length) return null;

return (
<div className={classNames('module-navigation-wrapper', { 'is-minimized': isMinimized })}>
<div ref={this.moduleNavRef} isZKAvailable={isZKAvailable} className="module-navigation">
{
modules.map((group, index) =>
this.renderGroup(group, index, user, currentRoute, isMinimized))
}
</div>
);
}
}

export default ModuleNavigation;


I want to pass the boolean isItAvailable to menu-items called modules here, and check the children of modules, for a specific one. If isItAvaialable =false dont show it










share|improve this question























  • FYI, this is the original Component without my componentWillRecieveProps implementation.

    – Dimitris Efst
    Nov 20 '18 at 11:02











  • I also removed a lot of imports and JSX regarding them to clear things up..

    – Dimitris Efst
    Nov 20 '18 at 11:05
















1















In the React Component that handles the Sidebar, we have the Menu Items, as modules. I want to pass a specific state from Redux, and in the case of false hide a specific item.
I did it but with passing the state as Props with componentWillRecieveProps. But I need to do it specifically with createSelector from reselect, as componentWillRecieveProps is gonna be deprecated and we are starting to using reselect more and more.



Problem is I have no idea how to do that. The reselect docs are more confusing than helping. So can you help a little?



Component:



import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createSelector } from 'reselect';

import { isRouteActive } from './location';

class ModuleNavigation extends Component {
static propTypes = {
modules: PropTypes.array,
user: PropTypes.object,
currentRoute: PropTypes.string,
isMinimized: PropTypes.bool,
isItAvailable: PropTypes.bool,
}

state = {
isOpen: false,
}

constructor(props) {
super(props);

this.topNavRef = React.createRef();
this.bottomNavRef = React.createRef();
this.moduleNavRef = React.createRef();
}

componentDidUpdate() {
this.updateArrows();
}

componentDidMount() {
this.updateArrows();
window.addEventListener('resize', this.updateArrows);
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateArrows);
}

onToggle = () => {
this.setState({ isOpen: !this.state.isOpen });
}

getRefId = (index) => {
if (index === 0) return this.topNavRef;
if (this.props.modules && index === this.props.modules.length - 1) return this.bottomNavRef;

return null;
}

renderGroup = (group, index, user, currentRoute, isMinimized) => (
<ul ref={this.getRefId(index)} key={group.name} className="module-navigation-group nav">
{
<li className={classNames('mt-10 mb-10 module-navigation-group-separator', { hidden: index === 0 })} />
}
{group.children
.filter(mod =>
mod.route && (!mod.permissions || userHasPermission(user, mod.permissions)))
.map(mod =>
(<li key={mod.name} className={classNames('module-navigation-group-item', { active: isRouteActive(currentRoute, mod.route) })}>
<a href={(mod.parentApp ? '#' : '') + mod.route} target={mod.target} title={mod.name}>
<i className={`fa ${mod.classNames} module-navigation-group-item-icon`} />
{!isMinimized && <span className="hidden-xs hidden-sm ml-15 module-navigation-group-item-label">{mod.name}</span>}
</a>
</li>))}
</ul>
)

render() {
const {
modules,
currentRoute,
user,
isItAvailable,
} = this.props;

if (!user || !modules || !modules.length) return null;

return (
<div className={classNames('module-navigation-wrapper', { 'is-minimized': isMinimized })}>
<div ref={this.moduleNavRef} isZKAvailable={isZKAvailable} className="module-navigation">
{
modules.map((group, index) =>
this.renderGroup(group, index, user, currentRoute, isMinimized))
}
</div>
);
}
}

export default ModuleNavigation;


I want to pass the boolean isItAvailable to menu-items called modules here, and check the children of modules, for a specific one. If isItAvaialable =false dont show it










share|improve this question























  • FYI, this is the original Component without my componentWillRecieveProps implementation.

    – Dimitris Efst
    Nov 20 '18 at 11:02











  • I also removed a lot of imports and JSX regarding them to clear things up..

    – Dimitris Efst
    Nov 20 '18 at 11:05














1












1








1








In the React Component that handles the Sidebar, we have the Menu Items, as modules. I want to pass a specific state from Redux, and in the case of false hide a specific item.
I did it but with passing the state as Props with componentWillRecieveProps. But I need to do it specifically with createSelector from reselect, as componentWillRecieveProps is gonna be deprecated and we are starting to using reselect more and more.



Problem is I have no idea how to do that. The reselect docs are more confusing than helping. So can you help a little?



Component:



import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createSelector } from 'reselect';

import { isRouteActive } from './location';

class ModuleNavigation extends Component {
static propTypes = {
modules: PropTypes.array,
user: PropTypes.object,
currentRoute: PropTypes.string,
isMinimized: PropTypes.bool,
isItAvailable: PropTypes.bool,
}

state = {
isOpen: false,
}

constructor(props) {
super(props);

this.topNavRef = React.createRef();
this.bottomNavRef = React.createRef();
this.moduleNavRef = React.createRef();
}

componentDidUpdate() {
this.updateArrows();
}

componentDidMount() {
this.updateArrows();
window.addEventListener('resize', this.updateArrows);
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateArrows);
}

onToggle = () => {
this.setState({ isOpen: !this.state.isOpen });
}

getRefId = (index) => {
if (index === 0) return this.topNavRef;
if (this.props.modules && index === this.props.modules.length - 1) return this.bottomNavRef;

return null;
}

renderGroup = (group, index, user, currentRoute, isMinimized) => (
<ul ref={this.getRefId(index)} key={group.name} className="module-navigation-group nav">
{
<li className={classNames('mt-10 mb-10 module-navigation-group-separator', { hidden: index === 0 })} />
}
{group.children
.filter(mod =>
mod.route && (!mod.permissions || userHasPermission(user, mod.permissions)))
.map(mod =>
(<li key={mod.name} className={classNames('module-navigation-group-item', { active: isRouteActive(currentRoute, mod.route) })}>
<a href={(mod.parentApp ? '#' : '') + mod.route} target={mod.target} title={mod.name}>
<i className={`fa ${mod.classNames} module-navigation-group-item-icon`} />
{!isMinimized && <span className="hidden-xs hidden-sm ml-15 module-navigation-group-item-label">{mod.name}</span>}
</a>
</li>))}
</ul>
)

render() {
const {
modules,
currentRoute,
user,
isItAvailable,
} = this.props;

if (!user || !modules || !modules.length) return null;

return (
<div className={classNames('module-navigation-wrapper', { 'is-minimized': isMinimized })}>
<div ref={this.moduleNavRef} isZKAvailable={isZKAvailable} className="module-navigation">
{
modules.map((group, index) =>
this.renderGroup(group, index, user, currentRoute, isMinimized))
}
</div>
);
}
}

export default ModuleNavigation;


I want to pass the boolean isItAvailable to menu-items called modules here, and check the children of modules, for a specific one. If isItAvaialable =false dont show it










share|improve this question














In the React Component that handles the Sidebar, we have the Menu Items, as modules. I want to pass a specific state from Redux, and in the case of false hide a specific item.
I did it but with passing the state as Props with componentWillRecieveProps. But I need to do it specifically with createSelector from reselect, as componentWillRecieveProps is gonna be deprecated and we are starting to using reselect more and more.



Problem is I have no idea how to do that. The reselect docs are more confusing than helping. So can you help a little?



Component:



import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createSelector } from 'reselect';

import { isRouteActive } from './location';

class ModuleNavigation extends Component {
static propTypes = {
modules: PropTypes.array,
user: PropTypes.object,
currentRoute: PropTypes.string,
isMinimized: PropTypes.bool,
isItAvailable: PropTypes.bool,
}

state = {
isOpen: false,
}

constructor(props) {
super(props);

this.topNavRef = React.createRef();
this.bottomNavRef = React.createRef();
this.moduleNavRef = React.createRef();
}

componentDidUpdate() {
this.updateArrows();
}

componentDidMount() {
this.updateArrows();
window.addEventListener('resize', this.updateArrows);
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateArrows);
}

onToggle = () => {
this.setState({ isOpen: !this.state.isOpen });
}

getRefId = (index) => {
if (index === 0) return this.topNavRef;
if (this.props.modules && index === this.props.modules.length - 1) return this.bottomNavRef;

return null;
}

renderGroup = (group, index, user, currentRoute, isMinimized) => (
<ul ref={this.getRefId(index)} key={group.name} className="module-navigation-group nav">
{
<li className={classNames('mt-10 mb-10 module-navigation-group-separator', { hidden: index === 0 })} />
}
{group.children
.filter(mod =>
mod.route && (!mod.permissions || userHasPermission(user, mod.permissions)))
.map(mod =>
(<li key={mod.name} className={classNames('module-navigation-group-item', { active: isRouteActive(currentRoute, mod.route) })}>
<a href={(mod.parentApp ? '#' : '') + mod.route} target={mod.target} title={mod.name}>
<i className={`fa ${mod.classNames} module-navigation-group-item-icon`} />
{!isMinimized && <span className="hidden-xs hidden-sm ml-15 module-navigation-group-item-label">{mod.name}</span>}
</a>
</li>))}
</ul>
)

render() {
const {
modules,
currentRoute,
user,
isItAvailable,
} = this.props;

if (!user || !modules || !modules.length) return null;

return (
<div className={classNames('module-navigation-wrapper', { 'is-minimized': isMinimized })}>
<div ref={this.moduleNavRef} isZKAvailable={isZKAvailable} className="module-navigation">
{
modules.map((group, index) =>
this.renderGroup(group, index, user, currentRoute, isMinimized))
}
</div>
);
}
}

export default ModuleNavigation;


I want to pass the boolean isItAvailable to menu-items called modules here, and check the children of modules, for a specific one. If isItAvaialable =false dont show it







javascript reactjs redux reselect






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 11:00









Dimitris EfstDimitris Efst

99111




99111













  • FYI, this is the original Component without my componentWillRecieveProps implementation.

    – Dimitris Efst
    Nov 20 '18 at 11:02











  • I also removed a lot of imports and JSX regarding them to clear things up..

    – Dimitris Efst
    Nov 20 '18 at 11:05



















  • FYI, this is the original Component without my componentWillRecieveProps implementation.

    – Dimitris Efst
    Nov 20 '18 at 11:02











  • I also removed a lot of imports and JSX regarding them to clear things up..

    – Dimitris Efst
    Nov 20 '18 at 11:05

















FYI, this is the original Component without my componentWillRecieveProps implementation.

– Dimitris Efst
Nov 20 '18 at 11:02





FYI, this is the original Component without my componentWillRecieveProps implementation.

– Dimitris Efst
Nov 20 '18 at 11:02













I also removed a lot of imports and JSX regarding them to clear things up..

– Dimitris Efst
Nov 20 '18 at 11:05





I also removed a lot of imports and JSX regarding them to clear things up..

– Dimitris Efst
Nov 20 '18 at 11:05












1 Answer
1






active

oldest

votes


















1














Hi you need a small refactoring to your class component, so that you can wrap the component with the connect hoc and get state values and inject them as props.



In your class component you make these changes, in order to get the isAvailable as prop, e.g. this.props.isAvailable:



// import connect hoc from react-redux
import { connect } from 'react-redux'

// import your selector from e.g. selectors.js, on the top
import {getIsAvailable} from './selectors'


// bottom, out of the class create the mapStateToProps function,
// in order to get state values and inject them as props to the component
const mapStateToProps = (state) => {
return {
isAvailable: getIsAvailable(state),
}
}

// you export your component wrapped with the connect hoc, like so
export default connect(mapStateToProps, null)(ModuleNavigation)


Into your selectors file, you import reselect and use CreateSelecto like so:



import { createSelector } from 'reselect'

// get the local state data.
// you are gonna change the structure based on yours
const getLocalState = state => state.data

// here with creteSelector:
// 1. call the localstate and return the data
// 2. get the data as param of an arrow func and
// make whatever we like with the data (calcs, checks etc)
// and finally return the data we need.
export const getIsAvailable = createSelector(
getLocalState,
data => data.isAvailable || false
)


Thats it. i hope it helps.






share|improve this answer



















  • 1





    I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

    – Dimitris Efst
    Nov 20 '18 at 13:38






  • 1





    I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

    – Theo Itzaris
    Nov 20 '18 at 17:14











  • Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

    – Dimitris Efst
    Nov 20 '18 at 18:30











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391548%2freact-pass-redux-state-with-create-selector-and-hide-menu-item%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Hi you need a small refactoring to your class component, so that you can wrap the component with the connect hoc and get state values and inject them as props.



In your class component you make these changes, in order to get the isAvailable as prop, e.g. this.props.isAvailable:



// import connect hoc from react-redux
import { connect } from 'react-redux'

// import your selector from e.g. selectors.js, on the top
import {getIsAvailable} from './selectors'


// bottom, out of the class create the mapStateToProps function,
// in order to get state values and inject them as props to the component
const mapStateToProps = (state) => {
return {
isAvailable: getIsAvailable(state),
}
}

// you export your component wrapped with the connect hoc, like so
export default connect(mapStateToProps, null)(ModuleNavigation)


Into your selectors file, you import reselect and use CreateSelecto like so:



import { createSelector } from 'reselect'

// get the local state data.
// you are gonna change the structure based on yours
const getLocalState = state => state.data

// here with creteSelector:
// 1. call the localstate and return the data
// 2. get the data as param of an arrow func and
// make whatever we like with the data (calcs, checks etc)
// and finally return the data we need.
export const getIsAvailable = createSelector(
getLocalState,
data => data.isAvailable || false
)


Thats it. i hope it helps.






share|improve this answer



















  • 1





    I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

    – Dimitris Efst
    Nov 20 '18 at 13:38






  • 1





    I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

    – Theo Itzaris
    Nov 20 '18 at 17:14











  • Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

    – Dimitris Efst
    Nov 20 '18 at 18:30
















1














Hi you need a small refactoring to your class component, so that you can wrap the component with the connect hoc and get state values and inject them as props.



In your class component you make these changes, in order to get the isAvailable as prop, e.g. this.props.isAvailable:



// import connect hoc from react-redux
import { connect } from 'react-redux'

// import your selector from e.g. selectors.js, on the top
import {getIsAvailable} from './selectors'


// bottom, out of the class create the mapStateToProps function,
// in order to get state values and inject them as props to the component
const mapStateToProps = (state) => {
return {
isAvailable: getIsAvailable(state),
}
}

// you export your component wrapped with the connect hoc, like so
export default connect(mapStateToProps, null)(ModuleNavigation)


Into your selectors file, you import reselect and use CreateSelecto like so:



import { createSelector } from 'reselect'

// get the local state data.
// you are gonna change the structure based on yours
const getLocalState = state => state.data

// here with creteSelector:
// 1. call the localstate and return the data
// 2. get the data as param of an arrow func and
// make whatever we like with the data (calcs, checks etc)
// and finally return the data we need.
export const getIsAvailable = createSelector(
getLocalState,
data => data.isAvailable || false
)


Thats it. i hope it helps.






share|improve this answer



















  • 1





    I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

    – Dimitris Efst
    Nov 20 '18 at 13:38






  • 1





    I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

    – Theo Itzaris
    Nov 20 '18 at 17:14











  • Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

    – Dimitris Efst
    Nov 20 '18 at 18:30














1












1








1







Hi you need a small refactoring to your class component, so that you can wrap the component with the connect hoc and get state values and inject them as props.



In your class component you make these changes, in order to get the isAvailable as prop, e.g. this.props.isAvailable:



// import connect hoc from react-redux
import { connect } from 'react-redux'

// import your selector from e.g. selectors.js, on the top
import {getIsAvailable} from './selectors'


// bottom, out of the class create the mapStateToProps function,
// in order to get state values and inject them as props to the component
const mapStateToProps = (state) => {
return {
isAvailable: getIsAvailable(state),
}
}

// you export your component wrapped with the connect hoc, like so
export default connect(mapStateToProps, null)(ModuleNavigation)


Into your selectors file, you import reselect and use CreateSelecto like so:



import { createSelector } from 'reselect'

// get the local state data.
// you are gonna change the structure based on yours
const getLocalState = state => state.data

// here with creteSelector:
// 1. call the localstate and return the data
// 2. get the data as param of an arrow func and
// make whatever we like with the data (calcs, checks etc)
// and finally return the data we need.
export const getIsAvailable = createSelector(
getLocalState,
data => data.isAvailable || false
)


Thats it. i hope it helps.






share|improve this answer













Hi you need a small refactoring to your class component, so that you can wrap the component with the connect hoc and get state values and inject them as props.



In your class component you make these changes, in order to get the isAvailable as prop, e.g. this.props.isAvailable:



// import connect hoc from react-redux
import { connect } from 'react-redux'

// import your selector from e.g. selectors.js, on the top
import {getIsAvailable} from './selectors'


// bottom, out of the class create the mapStateToProps function,
// in order to get state values and inject them as props to the component
const mapStateToProps = (state) => {
return {
isAvailable: getIsAvailable(state),
}
}

// you export your component wrapped with the connect hoc, like so
export default connect(mapStateToProps, null)(ModuleNavigation)


Into your selectors file, you import reselect and use CreateSelecto like so:



import { createSelector } from 'reselect'

// get the local state data.
// you are gonna change the structure based on yours
const getLocalState = state => state.data

// here with creteSelector:
// 1. call the localstate and return the data
// 2. get the data as param of an arrow func and
// make whatever we like with the data (calcs, checks etc)
// and finally return the data we need.
export const getIsAvailable = createSelector(
getLocalState,
data => data.isAvailable || false
)


Thats it. i hope it helps.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 11:22









Theo ItzarisTheo Itzaris

2,42621635




2,42621635








  • 1





    I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

    – Dimitris Efst
    Nov 20 '18 at 13:38






  • 1





    I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

    – Theo Itzaris
    Nov 20 '18 at 17:14











  • Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

    – Dimitris Efst
    Nov 20 '18 at 18:30














  • 1





    I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

    – Dimitris Efst
    Nov 20 '18 at 13:38






  • 1





    I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

    – Theo Itzaris
    Nov 20 '18 at 17:14











  • Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

    – Dimitris Efst
    Nov 20 '18 at 18:30








1




1





I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

– Dimitris Efst
Nov 20 '18 at 13:38





I have a question. What is the getIsAvaialable? Redux sends an entire object for this specific action, with all the app info. The question is. What do I pass in the selector..

– Dimitris Efst
Nov 20 '18 at 13:38




1




1





I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

– Theo Itzaris
Nov 20 '18 at 17:14





I m not sure that i got exactly your issue. I made a simple redux example here: codesandbox.io/s/j2r4l03nvw, that gets state properties and injects them into 'MyComponent', with 'createSelector'.

– Theo Itzaris
Nov 20 '18 at 17:14













Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

– Dimitris Efst
Nov 20 '18 at 18:30





Thank you. I got the gist of it. I used a little different approach. But your example was very useful.

– Dimitris Efst
Nov 20 '18 at 18:30




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391548%2freact-pass-redux-state-with-create-selector-and-hide-menu-item%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?