How to handle react set state using dictionary syntax with uglify?

330 Views Asked by At

React's documentation has handle change function which retrieves object key at the run time.

https://reactjs.org/docs/forms.html#handling-multiple-inputs

I have similar;

//handles state change
handleChange = prop => event => {
    this.setState({[prop]: event.target.value})
}

As far as I understand uglify plugin is changing key names at build time so how can/should I handle this?

Example: Let's say we have handleChange('name'), but in build time state.name becomes lets say state.n but It's updating state.name not state.n

Thank you.

0

There are 0 best solutions below