27
packages/react/src/Standard.tsx
Normal file
27
packages/react/src/Standard.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { useEffect } from 'react'
|
||||
import type { BotProps } from '@typebot.io/js'
|
||||
|
||||
type Props = BotProps
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
'typebot-standard': React.DetailedHTMLProps<
|
||||
React.HTMLAttributes<HTMLElement>,
|
||||
HTMLElement
|
||||
>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const Standard = (props: Props) => {
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
const { registerWebComponents } = await import('@typebot.io/js')
|
||||
registerWebComponents(props)
|
||||
})()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
return <typebot-standard />
|
||||
}
|
6
packages/react/src/index.ts
Normal file
6
packages/react/src/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/* eslint-disable import/no-anonymous-default-export */
|
||||
import { Standard } from './Standard'
|
||||
|
||||
export { Standard }
|
||||
|
||||
export default { Standard }
|
Reference in New Issue
Block a user