Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.16 KB

File metadata and controls

61 lines (48 loc) · 1.16 KB

remove-active-style

Usage

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

# or

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

Local Usage

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

Input / Output


basic

Input (basic.input.js):

const MyApp = ({ title }) => {
  return (
    <NavLink to="/messages" style={{ color: 'blue' }} activeStyle={{ color: 'green' }}>
      Messages
    </NavLink>
  );
};

Output (basic.output.js):

const MyApp = ({ title }) => {
  return (
    <NavLink
      to="/messages"
      style={(
        {
          'isActive': isActive
        }
      ) => ({
        'color': isActive ? 'green' : 'blue'
      })}>
      Messages
    </NavLink>
  );
};