React is a popular library to build user interfaces. If you want to use react to build custom Tasklist forms, you can use this example as a starting point. We adapted the React Multiple Inputs Example and integrated it into a process.
This example uses Jakarta API. It is compatible with the latest releases of Camunda Tomcat and WildFly distributions. This example works with Chrome and Firefox.
- Add loadReact.js to
app/tasklist/scripts/react
of the Camunda Tasklist webapp (e.g., for Tomcat, it will be/webapps/camunda/app/tasklist/scripts/react
). This will load React and ReactDOM from a CDN and add it to the global scope. If you want to use other versions of React, adjust the import paths accordingly. - Add the loader as a custom script in
app/tasklist/scripts/config.js
of the Camunda Tasklist webapp (e.g., for Tomcat, it will be/webapps/camunda/app/tasklist/scripts/config.js
).
customScripts: [
'scripts/react/loadReact.js'
]
That's it, you can now use react in your custom forms.
All process variables will be managed with the camForm.variableManager
. You need to load existing and create new variables. How this is done is described in detail in the Embedded Forms Reference.
Keep in mind that you also have to update the variables this way if they change. You can do this in the componentDidUpdate()
method of you form component.
componentDidUpdate() {
$scope.$$camForm.$dirty = true;
camForm.variableManager.variableValue('isGoing', this.state.isGoing);
camForm.variableManager.variableValue('numberOfGuests', this.state.numberOfGuests);
}
Yes you can. Just use any JSX preprocessor as you would with any other React project.
- Checkout the project with Git
- Build the project with maven
- Deploy the WAR file to the Camunda Workflow Engine
- Add React to Camunda Tasklist as described above
- Open Camunda Tasklist and start a process instance for the process named "React Example"