![](https://simbroadcasts.tv/assets/node-insim/react-node-insim-header.png)
🚧 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
![](https://raw.githubusercontent.com/simbroadcasts/react-node-insim/main/docs/button-sizes.png)
Stack
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/vertical-stack.png)
Flex
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/flex.png)
Grid
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/grid.png)
Toggle button
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/toggle-button.gif)
Toggle button group
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/toggle-button-group.gif)
Text box
![](https://github.com/simbroadcasts/react-node-insim/raw/main/docs/text-box.gif)
Hooks
- useOnConnect
- useOnDisconnect
- useOnPacket
- useConnections
- usePlayers
- useMessage
- useRaceControlMessage
- useInSim