🚧 This project is still under development. Any API may change as needed. Bugs and incomplete features are to be expected.
React Node InSim
Introducing React Node InSim, A React renderer for InSim buttons, based on Node.js with TypeScript support. It also provides layout components for easier button positioning, hooks for handling incoming InSim packets and tracking server connections & players.
Installation
npm install react@18 node-insim react-node-insim
or if you use Yarn:
yarn add react@18 node-insim react-node-insim
Basic Usage
To connect to an LFS server from your Node.js application, enter its hostname, a port and a short name for your application into the createRoot function, which will create a React root for you. Then you call root.render() just like you would with React DOM.
Minimal working example app
A Node.js app written in TypeScript, which displays a single button on local LFS.
https://github.com/mkapal/react-node-insim-example
Components showcase
Button
Stack
Flex
Grid
Toggle button
Toggle button group
Text box
Hooks
- useOnConnect
- useOnDisconnect
- useOnPacket
- useConnections
- usePlayers
- useMessage
- useRaceControlMessage
- useInSim