Undo/redo not working for button and input

I wonder why the undo button does not change anything for my app, which has input box and button.
My function looks like this:

@app.callback(Output('Docs', 'children'),
              [Input('button', 'n_clicks')],
              [State('input', 'value')])
def clean_data(n_clicks, input):
     if n_clicks is not None and input is not None:
            return ...

So for example, I enter “Option A” in the input box and click the button, then enter “Option B” in the input box and click the button. Then clicking undo nothing is changed. I am hoping that the undo can go back to “Option A”. What can I do to to make it work?