usehooks
usehooks copied to clipboard
refactor: the useHistoryStateReducer function using switch-case statement
This PR refactors the existing useHistoryStateReducer function by replacing the if-else statements with a more concise and readable switch-case statement. The new implementation enhances code clarity and maintainability, making it easier to understand and extend the logic for handling different action types.
Changes Made:
- Replaced if-else statements with switch-case statement for action type handling.
- Improved code structure and readability.
- No significant impact on performance expected.
This refactor aims to streamline the codebase and align with best practices for code organization and readability.