Dojo

Use react component in dojo2, has some interesting


#1

import WidgetBase from ‘@dojo/framework/widget-core/WidgetBase’;
import { v, dom } from ‘@dojo/framework/widget-core/d’;
import { tsx } from ‘@dojo/framework/widget-core/tsx’;
import * as css from ‘./styles/Home.m.css’;

import DatePicker from ‘antd/lib/date-picker’;
import ‘antd/lib/date-picker/style/css’;

import * as React from ‘react’;
import * as ReactDOM from ‘react-dom’;

export default class Home extends WidgetBase {
protected render() {
var datePicker = React.createElement(DatePicker);
var div = document.createElement(“div”);
ReactDOM.render(datePicker, div);
var node = dom({node:div});
return v(‘div’, { classes: [css.root]}, [node]);
}
}