我try 执行以下操作,但返回null:
import { Button as styledButton } from 'component-library'
然后try 将其渲染为:
import React, { PropTypes } from "react";
import cx from 'classNames';
import { Button as styledButton } from 'component-library';
export default class Button extends React.Component {
constructor(props){
super(props)
}
render() {
return (
<styledButton {...this.props}></styledButton>
)
}
}
原因是,我需要从库中导入Button
组件,还需要导出一个具有相同名称的包装器组件,但要维护导入组件的功能.如果我把它放在import { Button } from component library
,那么当然,我会得到一个多重声明错误.
有什么 idea 吗?