All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.Table.provider.TableRefProps.tsx Maven / Gradle / Ivy

The newest version!
import { createContext, useContext } from 'use-context-selector'
import React, { FC, useRef } from 'react'

import { TableWidgetContainerProps } from '../types/props'

const tablePropsContext = createContext | null>(null)

export const TableRefProps: FC<{ value: TableWidgetContainerProps }> = ({ value, children }) => {
    const refProps = useRef(value)

    refProps.current = value

    return (
        
            {children}
        
    )
}

export const useTableRefProps = () => {
    const context = useContext(tablePropsContext)

    if (!context) {
        throw Error('useTableRefProps must be used in TableRefProps')
    }

    return context
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy