Posts

Showing posts from February, 2026

RTK Query in React-Redux Application: Understanding it for handling HTTP calls and perform Query and Mutation

Image
RTK Query is a powerful data fetching and caching tool built provided in  Redux Toolkit . It eliminates the need to manually write thunks middlewares or any other middlewares like SAGA, as well as eliminated need for creating reducers, and selectors for server-side data. In this article, I walk through an example that reads and writes Category data from a REST API step by step. API Base URL used for this demo: https://myserver.dataservices.net/api/CategoryRead, for Read Operations and  https://myserver.dataservices.net/api/CategoryWrite Operations The Schema for Category Data Returned is as follows: {   "Records": [     {       "CategoryRecordId": 84,       "CategoryId": "",       "CategoryName": "",       "BasePrice": 0,       "Products": null     },      .......   ],   "StatusCode": 200,   "Message": "Categories are read successfully" ...

React.js: Use 'react-hook-form' and 'zod' for implementing the Form

Image
In this small post, I am going to discuss the Forms validation feature in React.js using the react-hoof-form and zod libraries. Why the Form Validations is important? Form validation is required to ensure that user inputs are correct, complete, and secure before submission, this helps to prevent invalid data from being sent to the backend and improves the user experience. The form validation results in following benefits: Data accuracy : To Prevents incomplete or incorrect data submissions. Security : This help to blocks malicious inputs e.g., SQL injection, XSS. User Experience: The improvements in user experience reliefs the end user about the error messages foe wrong or invalid data. Enforcement of Business Logic: This makes sure that the core business logic is actually enforces business logic the username must not be repeated or the rules for string password are follows or even the date ranges are set properly. Following are some of the common validation needs: Validatio...