I'm having a trouble of handling state-management and event management together on a single input element.
import React, { Component } from 'react';
export class profileDetail extends Component {
continue = (e) => {
e.preventDefault();
this.props.nextStep();
};
back = (e) => {
e.preventDefault();
this.props.prevStep();
};
render() {
const { values, handleChange } = this.props;
const imageHandler = () => {
//Do this thing..
//make this magic happen...
};
return (
<div>
Add your Profile Picture:
<input
-----HERE------> onChange={handleChange('ProfilePic')}
& defaultValue={values.ProfilePic}
-----HERE------> onChange={imageHandler}
type="file"
name="inpFile"
id="inpFile"
accept="image/*"
/>
</div>
);
}
}
export default profileDetail;
if i add two onChange on single input as above either i happen to get the state management working or either its the DOM manipulation with the onchange that gets working but not the both.
So, how and what changes should i make to get it working properly?
imageHandlerbody