docs: add demo for React hooks and context (#150)

This commit is contained in:
harttle
2019-10-08 21:50:59 +08:00
parent 3a7ddaa2c3
commit 7bae5bcb79
8 changed files with 84 additions and 5 deletions
+1 -4
View File
@@ -5,8 +5,7 @@ import tpl from './views/demo.liquid';
import Parser from 'html-react-parser';
import { engine } from './engine';
class App extends Component {
export class App extends Component {
async componentDidMount() {
const html = await engine.renderFile(tpl.toString(), {name: 'alice', logo: logo })
this.setState({ html }) // outputs "Alice"
@@ -22,5 +21,3 @@ class App extends Component {
);
}
}
export default App;