Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.17 KB

File metadata and controls

59 lines (46 loc) · 1.17 KB

remove-active-classname

Usage

npx react-router-v6-codemods remove-active-classname path/of/files/ or/some**/*glob.js

# or

yarn global add react-router-v6-codemods
react-router-v6-codemods remove-active-classname path/of/files/ or/some**/*glob.js

Local Usage

node ./bin/cli.js remove-active-classname path/of/files/ or/some**/*glob.js

Input / Output


basic

Input (basic.input.js):

const MyApp = ({ title }) => {
  return (
    <NavLink to="/messages" className="nav-link" activeClassName="activated">
      Messages
    </NavLink>
  );
};

Output (basic.output.js):

const MyApp = ({ title }) => {
  return (
    <NavLink
      to="/messages"
      className={(
        {
          'isActive': isActive
        }
      ) => 'nav-link' + (isActive ? ' activated' : '')}>
      Messages
    </NavLink>
  );
};