0
PARAMS不工作試圖在我的代碼庫但創建一個導航組件「...... PARAMS」導致‘意外的標記’錯誤:顯示......在我的關愛組件
render() {
const {router} = this.context;
const {
index,
onlyActiveOnIndex,
to,
children,
...params
} = this.props;
const isActive = router.isActive(to, onlyActiveOnIndex);
const LinkComponent = index
? Link
: IndexLink;
return (
<li className={isActive
? 'active'
: ''}>
<LinkComponent {...params}>{children}</LinkComponent>
</li>
);
}
錯誤:
ERROR in ./src/components/common/NavItem.js Module build failed: SyntaxError: C:/Development/varAssignPages/src/components/common/NavItem.js: Unexpected token (16:6)
在你的標題裏面寫着......道具,在你的問題裏......參數是哪一個呢? –