Skip to content

Instantly share code, notes, and snippets.

View daviddamilola's full-sized avatar
🏠
Working from home

oluwasusi david damilola daviddamilola

🏠
Working from home
View GitHub Profile

Everything I Know About UI Routing

Ingredients

  1. Location
    1. pathname
    2. state
    3. search/query
    4. hash
  2. Path
@daviddamilola
daviddamilola / GitCommitEmoji.md
Created April 27, 2020 10:56 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
export default function usePromise(api) {
const [state, dispatch] = useReducer(
(state, action) => {
switch (action.type) {
case 'LOADING':
return { ...state, loading: true }
case 'RESOLVED':
return { ...state, loading: false, response: action.response, error: null }
case 'ERROR':
return { ...state, loading: false, response: null, error: action.error }