mirror of
https://github.com/samuelcolvin/FastUI.git
synced 2023-12-01 22:22:11 +03:00
16 lines
416 B
TypeScript
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)
|
|
}
|
|
}
|