swc/tests/fixture/issue-1687/output/input.tsx
nuintun ef4bb314b9
fix(es/codegen): Remove extra space of import decl (#1975)
swc_ecma_codegen:
 - Remove extra space from import declarations. (#1690)
2021-07-29 18:56:59 +09:00

42 lines
1.4 KiB
TypeScript

import * as swcHelpers from "@swc/helpers";
import "core-js/modules/es.object.to-string";
import "core-js/modules/es.promise";
import regeneratorRuntime from "regenerator-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect, useState } from 'react';
import { render } from 'react-dom';
import zhCN from 'antd/es/locale/zh_CN';
import { Button, ConfigProvider } from 'antd';
function App() {
var ref = swcHelpers.slicedToArray(useState({
}), 2), state = ref[0], setState = ref[1];
useEffect(function() {
swcHelpers.asyncToGenerator(regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
case 0:
_ctx.next = 2;
return fetch('/api/user');
case 2:
setState(_ctx.sent);
case 3:
case "end":
return _ctx.stop();
}
}, _callee);
}))();
}, []);
return(/*#__PURE__*/ _jsxs(ConfigProvider, {
locale: zhCN,
children: [
"state: ",
state,
/*#__PURE__*/ _jsx(Button, {
children: "Antd"
})
]
}));
}
render(/*#__PURE__*/ _jsx(App, {
}), document.getElementById('root'));