Posts

Showing posts from February, 2025

cursor AI

 cmd+L: in mac to open chat window https://neetcode.io/courses/dsa-for-beginners/1 select a text and ctrl+k shortcut key to fill autosuggestion in cursor ChatGPT said: In Cursor AI Editor , the shortcut to accept an autosuggestion is: Shortcut Key for Auto-Suggestion Completion: ✅ Tab — Accepts the suggestion. ✅ Enter — Also works for some completions. If you're using GitHub Copilot or similar AI-assisted completions, Tab is the primary key to accept suggestions.  https://github.com/gopinav/React-TypeScript-Tutorials/blob/main/react-typescript-demo/src/components/generics/List.tsx https://github.com/gopinav/React-Query-Tutorials/tree/master/react-query-demo https://github.com/gopinav/Next.js-15-Tutorials https://github.com/machadop1407/react-firebase-course/blob/main/src/App.js

react hook form onErrors

 why onErrors will be used in react hook form Why is onErrors Used in React Hook Form? In React Hook Form , the onErrors callback is used with the handleSubmit function to handle validation errors when the form submission fails. It helps in debugging and displaying custom error messages when a field fails validation. 🔹 How onErrors Works? When using handleSubmit , you can pass two callbacks: Success Callback (onValid) → Executes when form validation passes. Error Callback (onErrors) → Executes when form validation fails . handleSubmit (onValid, onErrors); 🔹 Example: Handling Errors with onErrors import { useForm } from "react-hook-form" ; export default function App ( ) { const { register, handleSubmit, formState : { errors }, } = useForm (); const onValid = ( data ) => { console . log ( "Form Submitted Successfully:" , data); }; const onErrors = ( errors ) => { console . log ( "Form Errors:" , erro...

react hook form watch method

  https://github.com/gopinav/React-Hook-Form-Tutorials/blob/main/rhf-demo/src/index.css why watch will be used in react hook form Why is watch used in React Hook Form? In React Hook Form , the watch function is used to monitor changes in form fields in real time. It allows you to retrieve the current value of a field (or multiple fields) and react to changes without re-rendering the entire form . 🔹 Common Use Cases for watch Real-time Field Monitoring Update UI dynamically as the user types. Conditional Rendering Show or hide fields based on another field's value. Enable/Disable Submit Button Only enable the button when a field is valid. Live Validation Perform validation checks as the user types. 🔹 Basic Example: Watching a Single Input jsx import { useForm } from "react-hook-form" ; export default function App ( ) { const { register, watch } = useForm (); // Watching the 'email' input field const email = watch ( "email" ); re...

typescript react hook form yup validation

 https://myoutspark.com/ultimate-resume-test/v2?utm_source=Performance-Max&utm_medium=cpc&utm_campaign=RR-Outspark-Jobs-Inmarket-PMax-081024&utm_adgroup=Job-Search-Inmarket-Audience-New-LP&gad_source=2&gclid=CjwKCAiA5Ka9BhB5EiwA1ZVtvK_MwSKtVxomsaYFbb1-ivYNgWFi3j-m8yYTazQoLQn90nowignXWBoCVJoQAvD_BwE https://github.com/gopinav/React-Hook-Form-Tutorials/tree/main/rhf-demo https://react-hook-form.com/dev-tools https://www.react-hook-form.com/get-started#Quickstart https://github.com/jquense/yup https://github.com/gopinav/React-TypeScript-Tutorials