forwardRef
functionLets your component expose a DOM node to a parent component using a ref.
Import
import { forwardRef } from '@modular/sdk/editor';Notes
- see
- {@link https://react.dev/reference/react/forwardRef React Docs}
- see
- {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
- example
- ```tsx interface Props { children?: ReactNode; type: "submit" | "button"; } export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => ( <button ref={ref} className="MyClassName" type={props.type}> {props.children} </button> )); ```