๐Ÿ“ฆ ValeryG / reactmpls-reactrouter-talk

๐Ÿ“„ Books.jsx ยท 35 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35import React from 'react';

import Helmet from 'react-helmet';


export default React.createClass({

    getInitialState() {
        return {};
    },

    componentDidMount() {
        fetch("/data/books.json").then(res =>res.json())
            .then(books => this.setState(books));
    },

    render() {
        let {text = ''} = this.state;
        return  (

            <div>
                <Helmet
                    script={[
                        {src:"https://nthitz.github.io/turndownforwhatjs/tdfw.js"}

                    ]}
                />


                <span dangerouslySetInnerHTML={{__html: text}} />
            </div>
        )
    }
});