genkid2020

Untitled

Aug 28th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function Nomenclature(props) {
  2. const [isAddOpen, setIsAddOpen] = useState(false);
  3. const [isEditModalOpen, setIsEditModalOpen] = useState(false);
  4. const routeParams = useLocation();
  5. const classes = useStyles();
  6. const [currentType, setCurrentType] = useState('');
  7. const [tableTitle, setTableTitle] = useState('');
  8. const path = routeParams.pathname.split('/');
  9. const type = path[path.length - 1];
  10. let currentList = [];
  11. useEffect(() => {
  12. if (type === '1') {
  13. store.dispatch(Actions.get1Types());
  14. currentList = 1List;
  15. setCurrentType(1);
  16. } else if (type === '2') {
  17. store.dispatch(Actions.get2Types());
  18. currentList = 2List;
  19. setCurrentType(2);
  20. }, []);
  21. const 1List = useSelector(({ rew }) => rew.1Types);
  22. const 2List = useSelector(({ rew }) => rew.2Types);
  23. console.log(currentList);
Advertisement
Add Comment
Please, Sign In to add comment