79500866

Date: 2025-03-11 13:12:55
Score: 0.5
Natty:
Report link

When using typescript, you can pass the props type to the forwardRef as the second generic param. To use your example:

export const Services = () => {
  const servicesRef = useRef(null);

  return (
      <div>
        <ServicesList ref={servicesRef} />
      </div>
  );
};



export const ServicesList = forwardRef<HTMLTableSectionElement, PropsWithChildren<{}>>((props, ref) => {
  return (
      <section className="my-24 md:my-32" ref={ref}>
        {props.children}
      </section>
  );
});
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: Blee