I am trying to pass the data to parent component using handleclick but its functioning fine.
But it sends data to the parent like
if I typed option
it sends at parent optio
missing the last charactor.
Below is the call to the child component where onClickTitles I am fetching the data
<CreateEvent onClickTitles={this.handlerPollsValue} initialValues={this.state.init} />
In the CreateEvent
component here, this is my handleInputChange function
const [zValues, setValues] = useState('');
const handleInputChange = e => {
const { name, value } = e.target;
setValues({
...zValues,
[name]: value,
});
// here setting the values
onClickTitles(pValues);
};
Where I am setting the onClickTitles
values where pValues
is the value I am setting using setValues
const pValues = [
{
title: zValues.option1,
index: 0,
},
{
title: zValues.option2,
index: 1,
},
];
Everything works well but not getting the last charactor of what I type in input.
(I am using multiple <input>
compoennt for data inputs)
Can anyone help me here to resolve this?