score:1

Accepted answer

simply pass both state and props from your mapstatetoprops to your selectors.

if you use a selector directly as the mapstatetoprops function, it will receive the same arguments mapstate does: state and ownprops (props set on the connected component).

a simple example:

// simple selector
export const getsomethingfromstate = (state, { id }) => state.stuff[id]
// reselect selector
export const getstuff = createselector(
  getsomethingfromstate,
  (stuff) => stuff
)

// use it as mapdispatchtoprops
const mapdispatchtoprops = getsomethingfromstate

const mycontainer = connect(mapdispatchtoprops)(mycomponent)

// and set id as an own prop in the container when rendering
<mycontainer id='foo' />

however you're doing some weird things like mapping a selector to reuse it later. it doesn't work that way, at least it's not intended to be used that way.

you use selectors to retrieve slices of your state and pass it as props to your connected components. whenever the state changes, your selectors will be re-run (with some caching thanks to reselect). if something the component is actually retrieving from redux has changed indeed, it will re-render.

so your featureeditdialog component should be connected as well, and should be capable of retrieving anything it needs from the redux state, just by using props (which feature, which id, so on) in its own connect call.

this.props.showdialog(dialog); is a big code smell as well. ;)


Related Query

More Query from same tag