Registering Custom Components - Builder.io

PHOTO EMBED

Sun Oct 27 2024 13:28:53 GMT+0000 (Coordinated Universal Time)

Saved by @csd3x41

// for example, MyFunComponent.tsx
import { useState } from 'react';

export const MyFunComponent = (props: { text: string }) => {
  const [count, setCount] = useState(0);
  return (
    <div>
      <h3>{props.text.toUpperCase()}</h3>
      <p>{count}</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  );
};
content_copyCOPY

https://www.builder.io/c/docs/custom-components-setup