import { AppActions, AppDispatch } from '../store'; import { useNuiEvent } from '../hooks/useNuiEvent'; import { useDispatch } from 'react-redux'; import { Box, Text } from 'lr-components'; import { isEnvBrowser } from '../utils/misc'; interface Props { action: keyof typeof AppActions; } function AppActionHook(props: Props) { const dispatch = useDispatch(); const isDev = isEnvBrowser(); useNuiEvent(props.action, (data) => { //dynamicDispatch(action, data); // eslint-disable-next-line @typescript-eslint/no-explicit-any const a = AppActions[props.action] as any; dispatch(a(data)); }); return ( isDev && ( {props.action} ) ); } export default AppActionHook;