How to set activeClassName for wrapper element of Link or IndexLink in react-router?

前端 未结 10 1510
醉酒成梦
醉酒成梦 2020-12-07 15:56

I am new to the ReactJS world, and would like to know how can I pass active class name to the

  • element instead of (Link) element
  • 10条回答
    •  [愿得一人]
      2020-12-07 16:22

      In stead of using , I use and It works as well.

      import React, { Component } from 'react';
      import { NavLink } from 'react-router-dom';
      
      //.....
      
      export default class AppNav extends Component {
      
          render (){
              return (
                      
      • Home
      • About
      • Courses
      ); } }

    提交回复
    热议问题