react-router – 使用React-Semantic-UI CardGroups配置React Ro
发布时间:2020-12-15 05:05:21 所属栏目:百科 来源:网络整理
导读:我已经研究了一段时间,并遵循以下地方的文档: This issue on github带我到了semantic-ui-react documentation on Augmentation, 以及setting up route config with sub-routes上的react-router文档. 我的路由配置似乎有效,但目前还不清楚具体实现组件扩充的
我已经研究了一段时间,并遵循以下地方的文档:
This issue on github带我到了semantic-ui-react documentation on Augmentation, 以及setting up route config with sub-routes上的react-router文档. 我的路由配置似乎有效,但目前还不清楚具体实现组件扩充的位置. 我试过< Card.Group items = {items} as = {Link} to = {items.map((item,i)=>(item.href))} /> ;,以及试图把道具本身中的as = {Link},并且遇到了一堆错误,最终递归失败导致可怕的最大调用堆栈大小超出! 现在,我只是使用react-router对组件的路径进行硬编码.功能性方法会更优雅,反应更灵敏,这就是我所追求的!
您尝试将扩充应用于Card.Group,而实际上您希望将其应用于Card.
因此,子组件API的正确用法是: <Card.Group> <Card as={Link} to='/foo' /> <Card as={Link} to='/bar' /> </Card.Group> 正确使用速记API的方法是: const items = [ { as: Link,content: 'Foo',to: '/foo' },{ as: Link,content: 'Bar',to: '/bar' },] <Card.Group items={items} /> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |