Maquette 2.2 now supports JSX

Johan Gorter
Maquette news
Published in
2 min readFeb 8, 2016


A lot of code has changed in maquette 2.2, but there are almost no API changes since version 2.1. This is because maquette is now converted to Typescript and all of the functionality is now covered by unit tests. It does now meet the same quality standards that we use for the rest of our code at AFAS Software.

The only thing that is really new in this version, is that maquette now supports JSX. Most of the work for supporting JSX has already been done by the Babel project. This is because its ‘react jsx transform’ plugin can be configured to use a custom ‘pragma’ and can thus be configured to use maquette’s h method.

In order to use JSX, you have to install Babel with the following dependencies:

npm install babel-core babel-plugin-transform-react-jsx 

You also need the following .babelrc file

"presets": ["es2015"],
"plugins": [
["transform-react-jsx", {"pragma": "h"}]

Babel can now compile your code and the JSX will get converted into working hyperscript.

This also works with Typescript, because the Typescript compiler can be configured to preserve theJSX and you can then run Babel on the Typescript output. We created a starter application on github where we configured webpack to run both Typescript and Babel.

The only modification that we had to make in order to support JSX was to allow the class attribute for providing a static list of CSS classes. CSS classes that can be added and removed dynamically should still be specified using the classes attribute.

Ok, let me show you what JSX looks like in maquette.

So now we are facing a dilemma. Should we convert the code samples on the maquette homepage to use JSX or not? Will that attract a larger audience, or will the extra complexity scare people off? If you have an opinion, don’t hesitate to leave a comment.