부모 함수를 호출해서 처리하세요
const Parent = () => {
const history = useHistory();
const onAction = () => {
... some logic
history.goBack();
};
return (
..
<Child onAction={ onAction } ... />
);
}
const Child = ({ onAction }) => {
const onComplete = () => {
...
onAction();
};
return (
<form>
...
<button onClick={ () => onComplete() }>...</button>
</form>
)
};