0.0.2 • Published 7 years ago
@marvinh/instant-ssr-babel v0.0.2
JSX Babel Plugin For instant-ssr
This babel plugin is intended to be used in conjunction with instant-ssr. It
Usage
Install the package from the npm registry:
# with npm
npm install --save-dev @marvinh/instant-ssr-babel
# with yarn
yarn add -D @marvinh/instant-ssr-babel
and add it to your .babelrc
{
"plugins": ["@marvinh/instant-ssr-babel"]
}
What it does
It turns this:
function Foo(props) {
return (
<div>
{props.name}
<Bar />
</div>
);
}
function Bar(props) {
return <span>{props.hello}</span>;
}
const foo = <Foo name="bob" />;
into this:
import { html, hssr } from "@marvinh/instant-ssr";
function Foo(props) {
return html`<div>${props.name}${hssr(Bar, {})}</div>`;
}
function Bar(props) {
return html`<span>${props.hello}</span>`;
}
const foo = hssr(Foo, {
name: "bob",
});
License
MIT
, see the license file.
0.0.2
7 years ago