简体   繁体   English

React-router 带箭头的页面

[英]React-router pages with arrows

I want to change menu-pages (in react-router) with to icons ("back", "forward")...我想用图标(“后退”,“前进”)更改菜单页面(在反应路由器中)......

export const ArrowNav = () => {
    const menu = useContext(menuContext);

    return <div className="lmpixels-arrows-nav">
        <NavLink to={"/about"}>
            <div className="lmpixels-arrow-right">
                <i className="lnr lnr-chevron-right"/>
            </div>
        </NavLink>

        <NavLink to="/resume">
            <div className="lmpixels-arrow-left">
                <i className="lnr lnr-chevron-left"/>
            </div>
        </NavLink>
    </div>
}

Instead of using html css styles to show the icons you might like to try the package React Icons:而不是使用 html css styles 来显示您可能想尝试的图标 ZEFE90A8E604A7C840DE88D0

https://react-icons.github.io/ https://react-icons.github.io/

I, particularly, avoid using old CSS style names for icons like you are trying to do.我特别要避免使用旧的 CSS 样式名称作为您尝试做的图标。 In fact, I prefer to do all I can do to avoid the use of CSS files with React.事实上,我更愿意尽我所能避免在 React 中使用 CSS 文件。 Because React uses a lot js objects I believe it is better practice the use of some kind of CSS objects:因为 React 使用了很多 js 对象,我相信最好练习使用某种 CSS 对象:

https://www.w3schools.com/react/react_css.asp https://www.w3schools.com/react/react_css.asp

The error you are getting might depend on how are you importing the needed css information.您遇到的错误可能取决于您如何导入所需的 css 信息。

More info you might find useful:您可能会觉得有用的更多信息:

https://medium.com/swlh/using-react-router-navlink-to-specify-the-active-element-in-a-navigation-bar-38700ffd4900 https://medium.com/swlh/using-react-router-navlink-to-specify-the-active-element-in-a-navigation-bar-38700ffd4900

Hope this will help you希望对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM