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"/> 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
Post a Comment