jim 7 éve
szülő
commit
6e3422fef3
1 módosított fájl, 9 hozzáadás és 0 törlés
  1. 9 0
      src/routes/Account/Settings/Info.js

+ 9 - 0
src/routes/Account/Settings/Info.js

@@ -19,6 +19,15 @@ const menuMap = {
   currentUser: user.currentUser,
 }))
 export default class Info extends Component {
+  static getDerivedStateFromProps(props, state) {
+    const { match, location } = props;
+    let selectKey = location.pathname.replace(`${match.path}/`, '');
+    selectKey = menuMap[selectKey] ? selectKey : 'base';
+    if (selectKey !== state.selectKey) {
+      return { selectKey };
+    }
+    return null;
+  }
   constructor(props) {
     super(props);
     const { match, location } = props;