reactjs - 翻译成es6导入
问题描述
如何翻译成es6导入?
const bodyParser = require('body-parser');
require('body-parser-xml')(bodyParser);
我只知道50%
import * as bodyParser from 'body-parser';
但是如何添加最后的 50%?
解决方案
第二部分导入并调用一个函数,传递bodyParser
. 尝试
import * as bodyParserXml from 'body-parser-xml';
bodyParserXml(bodyParser);
推荐阅读
- javascript - Angular 6 不支持属性“catch”
- javascript - 为什么在反应 js 下拉列表中没有触发 onchange?
- json - 如何在 Spring Boot 中直接将 json 表单提交的字段映射到参数?
- c# - 转换为日期时间时出错(字符串未被识别为有效的日期时间。)
- java - 如何从组合框中获取索引
- c# - 在 ASP.NET CORE 2.0 中获取 JSON 结果
- sql - SQL 从 Access 导入数据 - 日期问题
- r - 如何将多列的频率计数与与 R 中的汇总统计相关的分类变量的转置结合起来
- apache-spark - 不明确的 Spark DataFrame 架构 - 非 JOINed 场景
- sql - SQL Server 2012:以年、日和月表示的 DATEDIFF 函数