FreeToolESX
esx-react
by TasoOneAsia · version 2020.12.24 · updated 2 days ago
No reviews yet
- Downloads
- 0
- Reviews
- 0
- Size
- 221 KB
- Code check
- Clean
- Licence
- MIT
- Released
- Nov 2026
A template for NUI development in FiveM using React, used by the ESX Team for modules (and also the internal esx-cli)
ESX NUI React Template
*This is an internal template created by @Taso and used by the ESX Dev Team
to easily boilerplate any new NUI modules planned to use React (or
Preact with minor changes). This is also used by the internal
with the
Although this is an internal ESX Team template, it works perfectly fine
if you wish to use it for any other purpose. 🎉
Essential Packages
As with any other Node environment, you must first run one of the following commands:
Building
To create a build for use in FiveM. Run the two following scripts
depending on the use-case.
Development
Production
After build, these scripts can be found in the build folder of the
project directory as shown:
*These builds differ in a couple of ways, most specifically: process.env.NODE_ENV,
source maps, minification, and the inclusion of a react-devtools module*
Using React Dev-Tools
When in development mode, the builds include with them a standalone
React DevTools bundle, that allows access to
to the browser environment.
First ensure you have
by running one of the following commands:
Then run this command from your terminal environment:
Now start your FiveM script with the development build, and you should
have access to the
Linting and Style
This template also comes with a preconfigured ESLint and Prettier config.
Both of these are run when using any of the build scripts. They can
also be run manually using:
*This is an internal template created by @Taso and used by the ESX Dev Team
to easily boilerplate any new NUI modules planned to use React (or
Preact with minor changes). This is also used by the internal
esx-cliwith the
React template.*Although this is an internal ESX Team template, it works perfectly fine
if you wish to use it for any other purpose. 🎉
Essential Packages
- React - v17.0
- TypeScript - v4.0
- Webpack - v5.10
- Prettier - v2.2
- ESLint - v7.16
As with any other Node environment, you must first run one of the following commands:
**Yarn**
yarn
**NPM**
npm iBuilding
To create a build for use in FiveM. Run the two following scripts
depending on the use-case.
Development
**Yarn:**
yarn build:dev
**NPM**
npm run build:devProduction
**Yarn:**
yarn build:prod
**NPM**
npm run build:prodAfter build, these scripts can be found in the build folder of the
project directory as shown:
|-- build
|-- index.html
|-- index.js*These builds differ in a couple of ways, most specifically: process.env.NODE_ENV,
source maps, minification, and the inclusion of a react-devtools module*
Using React Dev-Tools
When in development mode, the builds include with them a standalone
React DevTools bundle, that allows access to
react-devtools comparableto the browser environment.
First ensure you have
react-devtools installed globallyby running one of the following commands:
**Yarn**
yarn global add react-devtools
**NPM**
npm install -g react-devtoolsThen run this command from your terminal environment:
react-devtoolsNow start your FiveM script with the development build, and you should
have access to the
react-devtools just as you would in the browser!Linting and Style
This template also comes with a preconfigured ESLint and Prettier config.
Both of these are run when using any of the build scripts. They can
also be run manually using:
**Prettier**
yarn format
**ESLint**
yarn lint