showing results for - "multiple path name for same navlink"
Mira
08 Apr 2020
1import React from 'react';
2import { useLocation } from 'react-router-dom';
3
4// Active the Link on two URLs
5
6export default () => {
7	
8    // extract pathname from location
9    const { pathname } = useLocation();
10
11	return (
12    	<li className='Navigation__list-item'> 
13        	<NavLink 
14            	to="/events" 
15                isActive={() => ['/events', '/myevents'].includes(pathname)} >
16                Events 
17            </NavLink> 
18        </li>
19    );
20};