Skip to content

TianyuanC/react-redux-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Redux Demo

Based on this tutorial with minor tweaks on stylings and a few experiment on the hooks integration, undo/redo, multiple todo instances, unit tests and so on.

Launch script

yarn && yarn start

React Hooks

import { useSelector, useDispatch } from "react-redux";
import { setFilter } from "../redux/actions";
import { useCallback } from "react";

export const useFilter = () => {
    const dispatch = useDispatch();

    const setFilterAction = useCallback(filter => dispatch(setFilter(filter)), [
        dispatch
    ]);

    const activeFilter = useSelector(state => state.visibilityFilter);
    return {
        setFilterAction,
        activeFilter
    };
};

Future

  • Look into useMemo and useCallback
  • Use styled-component or emotion
  • How about Web Component?

About

React Nanodegree candidate demo topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors