gpt4 book ai didi

javascript - React Router v4 的优点

转载 作者:行者123 更新时间:2023-12-03 12:54:23 24 4
gpt4 key购买 nike

除了能够在 NavLink 上设置“activeClassName”和“activeStyle”之外,在非网络上创建指向其他路线的链接时,是否有任何理由使用 NavLink 而不是 Link - 网站上不需要事件状态/类的导航元素(即不是页眉或页脚中的主导航)?

最佳答案

official documentation很清楚:

<NavLink>

A special version of the <Link> that will add styling attributes to the rendered element when it matches the current URL.

因此,答案是。除了上述原因外,没有其他原因。

关于javascript - React Router v4 <NavLink> 与 <Link> 的优点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47338077/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com