NOTE: To be able to close the side menu in a React Iionic application, the screen size must me smaller to be able to toggle the side menu. If the application is rendered into a large screen, the side menu will be shown by default and the code will not work because it must be a smaller screen where the side menu is minimized.
1. Step 1 - Import menuController
1. Step 2 - Create a function to be called when the button is clicked or whenever you want it to run in your code.
2. Step 3 - Add the JSX code for the button to trigger the toggle to open or close.
That is it, Done and simple solution.
More Info: https://ionicframework.com/docs/ja/v6/api/menu