React svg element

    0

    0

    Giovanny Gongora

    Codiga's TypeScript Recipes

    Pass down reference and apply the prop type to a SVG

    interface ISVGProps {
      reference?: React.RefObject<SVGSVGElement>
    }
    const SVG = (props: ISVGProps) => {
      return (
        <svg
        	ref={props.reference}
          className={classes.Triangle}
          {...props} />
          <path d='M0,0 10,10 20,0' />
      	</svg>
    	)
    }
    <SVG reference={myReference} />
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.