mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
24 lines
559 B
JavaScript
24 lines
559 B
JavaScript
import React, { Component } from 'react';
|
|
import logo from './logo.svg';
|
|
import './App.css';
|
|
import tpl from './views/demo.liquid';
|
|
import Parser from 'html-react-parser';
|
|
import { engine } from './engine';
|
|
|
|
export class App extends Component {
|
|
async componentDidMount() {
|
|
const html = await engine.renderFile(tpl.toString(), {name: 'alice', logo: logo })
|
|
this.setState({ html }) // outputs "Alice"
|
|
}
|
|
|
|
state = { html: '' }
|
|
|
|
render() {
|
|
return (
|
|
<div className="App">
|
|
{Parser(`${this.state.html}`)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|