목록분류 전체보기 (373)
Silver Library (Archived)
import React, { useState, useEffect } from "react"; import { useForm, Controller } from "react-hook-form"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import axios from "axios"; function App() { const [loadedDate, setLoadedDate] = useState(new Date()); const { control, handleSubmit } = useForm(); useEffect(() => { // Fetch data from API server ..
Q1. In reactjs, there is hook calls react-datepicker. I set a query path to call date data from backend server with axios either get and post, and there are two input, these are in the tag. This form tag includes something like this: In this form tag, there are two loaded react-datepicker as . Suppose, first DatePicker is start date, and second DatePicker is end date. Which means, second DatePic..
useReducer is a built-in hook in React that allows you to manage state in your functional components using a reducer function, which is similar to the way state is managed in Redux. Here's how it works: You define a reducer function that takes in a current state and an action and returns a new state based on the action. You use the useReducer hook to initialize the state and get a dispatch funct..
특징이 있다면, register, 그리고 onSubmit, handleSubmit. 이렇게 자주 쓰인다는 점. 그리고 이걸, onSubmit 으로 보내주는 건지, 진짜 어마어마한 미궁이라는 생각이 들었습니다. 도대체 엮은 것도 없는데, 무슨 재주로 저걸 const 변수 선언 영역에서 참조하는 state 변수명 지정도 없이 바로 버튼을 인식 해서 그렇게 바로 patch request 가 전송되는지. CRUD 또한 이해하고 있고, 그렇다면 남은건...react hook form 이다는 점. 그러던 중, 이 글을 발견했습니다. 편리한 input 다루기 - React Hook Form (velog.io) 편리한 input 다루기 - React Hook Form yarn add react-hook-form@6 (..