Files
FastUI/react/fastui/hooks/customRender.ts
Samuel Colvin eb6147512c moving python
2023-11-12 20:15:23 +00:00

16 lines
416 B
TypeScript

import { createContext, FC, useContext } from 'react'
import { FastProps } from '../components'
export type CustomRender = (props: FastProps) => FC | void
export const CustomRenderContext = createContext<CustomRender | null>(null)
export const useCustomRender = (props: FastProps): FC | void => {
const customRender = useContext(CustomRenderContext)
if (customRender) {
return customRender(props)
}
}