reactjs - 如何在反应浏览器中导入 unpkg 组件
问题描述
我通过从 unpkg 导入直接在浏览器中使用 React。但是当我包含组件时react-pagination-js
,Pagination
在整个范围的其余部分仍然未定义。
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
<!-- react-js-pagination -->
<script src="https://unpkg.com/react-pagination-js@2.0.0/dist/index.umd.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="{% static 'js/practice/ChallengeList.js' %}"></script>
<script type="text/babel">
const e = React.createElement;
const el = document.querySelector('#challenges-component');
ReactDOM.render(e(ChallengeList), el);
</script>
如何Pagination
在我的ChallengeList
组件中使用?
解决方案
推荐阅读
- spring - Spring Netflix Eureka Server 以非法 URL 启动 intelliJ
- android - 如何将 ImageView 与 TextView 垂直居中,同时确保 TextView 有足够的空间显示?
- python - 通过沿一个轴堆叠将两个 numpy 视图组合成一个视图
- c# - MIBPostProcessDependencyGraph 后期构建任务在 msbuild 中失败
- java - 在 Java8 Consumer andThen 中使用“?super T”的目的
- javascript - 使用 for 循环填充数组并显示它
- java - 使用 GUI 的素数分解(swing/awt)
- ruby-on-rails - 在“收藏夹”连接模型 Rails 5.2 上出现 NoMethod 错误
- typescript - 使用通用对象类型联合进行类型缩小
- javascript - 更改场景 Phaser 3 时出现黑屏