Adds a pipe operator to call pure, synchronous transformer functions within JSX expressions.
A pipe inside a JSX expression,
const Shout = ({ name }) => (
<div>YO, { name | toUpperCase }!</div>
);
Becomes a function call in the result:
const Shout = ({ name }) => (
<div>YO, { toUpperCase(name) }!</div>
);
To pass a parameter, implement the transformer as a factory.
const toFixed = (places) => (value) => value.toFixed(places);
const Cell = ({ value }) => (
<td>{ value | toFixed(2) }</td>
);
const toFixed = (places) => (value) => value.toFixed(places);
const Cell = ({ value }) => (
<td>{ toFixed(2)(value) }</td>
);