OCaml JSX for ReasonReact
npm install ppx_bsxOCaml JSX for ReasonReact.
- yarn add -D ppx_bsx or npm i --save-dev ppx_bsx
- add "ppx-flags": ["./node_modules/ppx_bsx/bin/ppx_bsx.exe"] to bsconfig.json
👉
This is how it feel:
``ocaml`
[%bsx "
Nice example
"]
- When you need OCaml expression, wrap it with double quotation marks, otherwise
- For string literal value, just use single quotation marks
- For singe text node, you don't need to wrap it to ReasonReact.stringToElement, (surprisedly)
is accepted$3
For non-ascii string, you can simply use string literal like
{|䏿–‡|}, ppx_bsx will convert to {j|䏿–‡|j}` automatically.