Getting Started
Getting started with @motor-js/engine

Install via npm

The fastest way to get started is to install via npm.
1
npm i @motor-js/engine
Copied!

Usage

Start by wrapping your application with the Motor component, at the root of your project. This handles connection to the Qlik engine and is needed for any of the hooks to work.
You can either set the configuration to your Qlik site directly in this component, or pass the engine object (useful if you are handling custom authentication and connection).
1
// 1. Import the Motor component
2
import { Motor } from @motor-js/engine
3
4
function App() {
5
6
return (
7
// 2. Use at the root of your project
8
<Motor
9
config={
10
host: "myqliksite.qlik.com",
11
secure: true,
12
port: 433,
13
prefix: "",
14
appId: 'myAwesomeApp',
15
}>
16
<App />
17
</Motor>
18
)
19
}
Copied!
Next, import the hooks or contexts into your project and you are good to go. In the below example we are extracting data from the useList hook.
1
import { useList } from "@motor-js/engine"
2
3
const Filter = () => {
4
5
const dimension = ['Country'];
6
7
const {
8
listData,
9
} = useList({
10
dimension,
11
});
12
13
console.log(listData);
14
15
return (
16
<div></div>
17
);
18
19
};
Copied!
Use the link below to jump to more details on how to use the hooks in the package.

Usage with Qlik Sense Cloud

If you are connecting to a Qlik cloud SAAS instance, your configuration will look slightly different. We need to set the qcs entry to true and also add the web integration id, generated in your Qlik site.
1
import { Motor }from '@motor-js/core'
2
<Motor
3
config={{
4
host: 'motor.eu.qlikcloud.com',
5
secure: true,
6
port: null,
7
prefix: '',
8
appId: '39e218c1-42ee-4f38-9451-1b8f850505d5',
9
webIntId: '...',
10
qcs: true,
11
}}>
12
>
13
// ...
14
</Motor>
15
Copied!
For more information on how to generate your first web integration id in Qlik SAAS, head to the Qlik docs.

Usage with Qlik Sense Enterprise

If you are using Qlik Sense Enterprise, you will need to handle authentication to the Engine yourself. You can find an example React project below. Once you've connected to your engine instance, you can pass the returned object to your Motor component.
GitHub - motor-js/qs-custom-auth-motor: Example custom authentication using motor
GitHub
Last modified 1mo ago