How to use the callback function for a component actions