Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

button ref react

import React, { useRef } from "react";
const ActionButton = ({ label, action }) => {
  const buttonRef = useRef(null);
  return (
    <button onClick={action} ref={buttonRef}>
      {label}
    </button>
  );
};
export default ActionButton;
Source by blog.logrocket.com #
 
PREVIOUS NEXT
Tagged: #button #ref #react
ADD COMMENT
Topic
Name
9+9 =