When wrapping material TextField with a redux component, it is important to consider that some properties should be used in mapStateToProps only and not passed directly to the component. Otherwise, an Unknown prop warning may occur. Even specifying an undefined value does not resolve this issue.
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 a simpler way to remove something from ownProps in mapStateToProps without creating a wrapper component?