Reactjs 如何在html中使用React组件和设计

Reactjs 如何在html中使用React组件和设计,reactjs,babeljs,antd,Reactjs,Babeljs,Antd,我请求你的帮助。我的任务很简单。我正在通过CDN(无节点js服务器)和Ant Design CDN使用React。我需要在我的React应用程序中使用Ant设计组件。然而,这对我根本不起作用。我记得,几个月前我做过,但现在我无法复制。下面是我的代码。Chrome控制台上说 Panel.js:272 Uncaught TypeError: moment__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function at Module

我请求你的帮助。我的任务很简单。我正在通过CDN(无节点js服务器)和Ant Design CDN使用React。我需要在我的React应用程序中使用Ant设计组件。然而,这对我根本不起作用。我记得,几个月前我做过,但现在我无法复制。下面是我的代码。Chrome控制台上说

Panel.js:272 Uncaught TypeError: moment__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function
    at Module../node_modules/_rc-time-picker@3.7.2@rc-time-picker/es/Panel.js (Panel.js:272)
    at __webpack_require__ (bootstrap:19)
    at Module../components/date-picker/wrapPicker.tsx (antd.js:9472)
    at __webpack_require__ (bootstrap:19)
    at Module../components/date-picker/index.tsx (antd.js:9344)
    at __webpack_require__ (bootstrap:19)
    at Module../components/index.tsx (index.tsx:1)
    at __webpack_require__ (bootstrap:19)
    at Object../index.js (index.js:25)
    at __webpack_require__ (bootstrap:19)
我用谷歌搜索了这个问题,很明显,浏览器无法识别require(import)命令。 我真诚地请求你的帮助。 谢谢大家!

<!doctype html>
<html lang="en-us">
  <head>

    <!-- React CNDs -->
    <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js'></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js'></script>

    <!-- Material Design CDNs-->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
    <!-- <script type="module" src="https://unpkg.com/@material-ui/core@4.4.3/umd/material-ui.production.min.js"></script>  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/antd/3.23.4/antd.js" integrity="sha256-x4ITqB7m84o5/YGY7vx7hmRvoWj/Yj7Zm4+Yxipq+r0=" crossorigin="anonymous"></script>
  </head>
  <body>


    <div id="root"></div>

    <script type="text/babel">
    const {Button} = window['antd']

        class App extends React.Component {

            render() {

              return (
                <Button type="primary">
                  Test
                </Button>
              );
            }
          }
    ReactDOM.render(<App />, document.getElementById('root')); 
    </script>
  </body>
</html>

常量{Button}=window['antd']
类应用程序扩展了React.Component{
render(){
返回(
试验
);
}
}
ReactDOM.render(,document.getElementById('root'));

遵循示例项目。导入的方式有点不同。

可能重复@RyanCogswell您是个救命恩人。它起作用了!我稍微改变了主题链接,只有答案不是很好。除了Ant设计,我怎么能使用相同的方法呢?我试过了,但除了按钮是未定义的错误外,我还有TypeError:moment\uuuu WEBPACK\u IMPORTED\u MODULE\uu 2\uuuuuuu default(…)不是一个函数我稍微改变了主题
<!doctype html>
<html lang="en-us">
  <head>

    <!-- React CNDs -->
    <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js'></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js'></script>

    <!-- Material Design CDNs-->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
    <!-- <script type="module" src="https://unpkg.com/@material-ui/core@4.4.3/umd/material-ui.production.min.js"></script>  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/antd/3.23.4/antd.js" integrity="sha256-x4ITqB7m84o5/YGY7vx7hmRvoWj/Yj7Zm4+Yxipq+r0=" crossorigin="anonymous"></script>
  </head>
  <body>


    <div id="root"></div>

    <script type="text/babel">
    const {Button} = window['antd']

        class App extends React.Component {

            render() {

              return (
                <Button type="primary">
                  Test
                </Button>
              );
            }
          }
    ReactDOM.render(<App />, document.getElementById('root')); 
    </script>
  </body>
</html>