Skip to content

Instantly share code, notes, and snippets.

@OliverJAsh
Created September 10, 2018 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OliverJAsh/bed05c84fdf1d057ab5fc29033e81d4f to your computer and use it in GitHub Desktop.
Save OliverJAsh/bed05c84fdf1d057ab5fc29033e81d4f to your computer and use it in GitHub Desktop.
// render.ts
import * as states from './states';
export const render = (state: states.State) => {
switch (state.type) {
case states.StateType.Form:
return 'Form';
case states.StateType.Loading:
return `Loading results for ${state.query}`;
case states.StateType.Failed:
return 'Failed';
case states.StateType.Gallery:
return `Results: ${state.items.length}`;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment