React newsletter


Posted by mijouhsieh on 2023-12-24

codesandbox
練習來源: https://rudy.capital/en/home/#faq
react-form-rudy-newsletter.png

應用 useState, useRef, forwardRef
React useRef

子元件 使用 forwardRef,可讓父元件獲得 子元件的 ref,讓父元件能訪問和操作子元件。

將元件都寫在Form.js中。import forward函式

import React, { useState, forwardRef } from "react";
import { useRef } from "react";
import styles from "./Form.module.css";

子元件

react-form-inputName.png

react-form-inputEmail.png

父元件

react-form.png


再實作相關功能

CHATGTP


#useRef #forwardRef #useState #Reacr form #newsletter







Related Posts

打造後台管理系統的好幫手:Ant Design

打造後台管理系統的好幫手:Ant Design

Javascript - 基礎

Javascript - 基礎

Week1: Git 遠端協作及 Pull Request

Week1: Git 遠端協作及 Pull Request


Comments