I use formsy-react v1.1.5 for validation and i have about 100 input field and its unbelievably slow because of an unnecessary object.assign function in their code. I know that the higher versions fixed this issue but i can not update it right now.
I have totally no idea about monkey patching and i dont want to use any patching libraries to get the work done. I would like to understand how it can be patched.
this code:
getCurrentValues = () => (
this.inputs.reduce((data, component) => {
const { name } = component.props;
const dataCopy = Object.assign({}, data); // avoid param reassignment
dataCopy[name] = component.state.value;
return dataCopy;
}, {})
)
getPristineValues = () => (
this.inputs.reduce((data, component) => {
const { name } = component.props;
const dataCopy = Object.assign({}, data); // avoid param reassignment
dataCopy[name] = component.props.value;
return dataCopy;
}, {})
)
I want to make the following changes:
getCurrentValues = () => (
this.inputs.reduce((data, component) => {
const { name } = component.props;
data[name] = component.state.value;
return data;
}, {})
)
getPristineValues = () => (
this.inputs.reduce((data, component) => {
const { name } = component.props;
data[name] = component.props.value;
return data;
}, {})
)
Thanks.