React integration

Find out how to integrate JSQL with React

Stack requirements

The JSQL will not work with React without an account in the JSQL cloud, a backend application (API) integrated with JSQL and integration with the tasks of the runner. To learn more see overview.

Axios or Superagent module installation

Install JSQL Superagent or Axios plugin to your project

npm install jsql-superagent


npm install jsql-axios

Import modules

Import JSQL Superagent or Axios plugin in your JavaScript file:

import JsqlService from 'jsql-superagent';


import JsqlService from 'jsql-axios';


First of all, you need to initiate JSQL object:

let jsqlService = new JsqlService({
 host: 'https://mysite.com/'

You can also pass additional configuration parameters.

Then let’s add jsql instance into state:

this.state.jsql = jsqlService.getInstance();

Finally, we can use JSQL:

this.state.jsql.delete('@sql delete from person where age = :age')
.param('age', 30)
.then((res) => {
}).catch((e) => {

For details on using other methods like delete, update, insert and binding parameters, see the documentation.

Example integration with React and JSQL CLI in package.json

This example needs concurrently module to be installed.

This example needs Disable hashing for development mode option enabled in security options.

"scripts": {
"serve": "concurrently --kill-others \"react-scripts start\" \"npm run jsql-watch\"",
"jsql-watch": "jsql-cli --apiKey=(..) --input=/src/**/*.js --watch",
"jsql-build": "jsql-cli --apiKey=(..) --devKey=(..) --output=/build/static/js/main.[...].chunk.js --input=/build/static/js/main.[...].chunk.js",
"build": "react-scripts build && npm run jsql-build"
Close Menu