aboutsummaryrefslogtreecommitdiff
path: root/src/debug/Test.tsx
blob: c8de33f4169dec387e61f6610edd64df378ad117 (plain)
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
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import JsxParser from 'react-jsx-parser'

class Hello extends React.Component<{ firstName: string, lastName: string }> {
    render() {
        return <div>Hello {this.props.firstName} {this.props.lastName}</div>
    }
}

class Test extends React.Component {
    render() {
        let jsx = "<Hello {...props}/>";
        let bindings = {
            props: {
                firstName: "First",
                lastName: "Last"
            }
        }
        return <JsxParser jsx={jsx} bindings={bindings} components={{ Hello }}></JsxParser>
    }
}

ReactDOM.render((
    <div style={{ position: "absolute", width: "100%", height: "100%" }}>
        <Test />
    </div>),
    document.getElementById('root')
);