Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Ky6uk/atom-typescript-duck-snippet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Atom Duck snippet for React/Redux and TypeScript

The Duck snippet for React/Redux. This snippet uses TypeScript syntax.

The Snippet

Trigger Content
duck the snippet

Generated Code

interface Action {
  readonly type?: string;
}

const defaultState = {};

// Actions
const ACTION = 'duck-name/ACTION';

// Reducer
export default function reducer(state = defaultState, action: Action = {}) {
  switch (action.type) {
    case ACTION: {
      return state;
    }

    default: {
      return state;
    }
  }
}

// Action Creators

export function actionCreator() {
  return { type: ACTION };
}

License

MIT License © Roman Nuritdinov (Ky6uk)