project-error / fivem-react-boilerplate-lua

Basic Lua & React (TypeScript) boilerplate for FiveM

Home Page:https://projecterror.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to send data with no NUI callback

Rasinzz opened this issue · comments

I made a vehicle hud that displays speed, gear and rpm when inside a vehicle. It doesn't have any buttons to click, so it doesn't use the native RegisterNUICallback at all. I was wondering how I can send data (such as speed, gear, etc.) back to React from the client-sided Lua code?

commented

Client: SendReactMesssage("speed", speed)
UI: useNuiEvent("speed",(speed) => {setSpeed(speed})