📜  获取元素参考反应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.334000             🧑  作者: Mango

代码示例1
import React, { useEffect, useRef } from "react";

const MyComponent = () => {
  const myContainer = useRef(null);
  
  useEffect(() => {
    console.log("myContainer..", myContainer.current);
  });

  return (
    <>
      

Ref with react

I can use the DOM with react ref
); }; export default MyComponent;