为什么 es6 react 组件仅适用于“导出默认值”?
2022-08-30 00:20:32
此组件可以工作:
export class Template extends React.Component {
render() {
return (
<div> component </div>
);
}
};
export default Template;
如果我删除最后一行,它不起作用。
Uncaught TypeError: Cannot read property 'toUpperCase' of undefined
我想,我不理解es6语法中的某些东西。难道它不必在没有符号“默认”的情况下导出吗?