javascript - Removing properties in mapStateToProps -


i'm wrapping material textfield redux component. of properties should used in mapstatetoprops , not passed component itself. otherwise, i'm getting unknown prop warning. specifying undefined value doesn't help.

function mapstatetoprops(state = {}, ownprops) {     var datakey = ownprops.datakey;     return {         value: state[datakey],         datakey: undefined     } } const store = createstore(reducer, {stuff: 123});  const todraw = <textinput datakey="stuff"/> 

jsfiddle

is there simpler way remove ownprops in mapstatetoprops rather creating wrapper component?

you supplying function connect's 3rd argument mergeprops, defaults to:

function mergeprops(stateprops, dispatchprops, ownprops) {   return object.assign({}, ownprops, stateprops, dispatchprops); } 

write own version cherry-picks props want send component.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -