I was wondering if I can optimaze the follwoing functions into one or two functions instead of four. Here is the link to the code
// Proceed to next step
const firstStep = (firstName, lastName) => {
setInputValue((prevState) => ({
...prevState,
step: prevState.step + 1,
firstName: firstName,
lastName: lastName,
}));
};
// Proceed to next step
const secondStep = (email, password) => {
setInputValue((prevState) => ({
...prevState,
step: prevState.step + 1,
email: email,
password: password,
}));
};
const thirdStep = () => {
setInputValue((prevState) => ({
...prevState,
step: prevState.step + 1,
}));
};
const fourthStep = () => {
setInputValue((prevState) => ({
...prevState,
step: prevState.step + 2,
}));
};
fourthStepfunction to add 2 to the step?