Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Last active July 15, 2018 00:29
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 FagnerMartinsBrack/23be7a49e9580d3ef7a0b4c1e06161f4 to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/23be7a49e9580d3ef7a0b4c1e06161f4 to your computer and use it in GitHub Desktop.
(Medium) - Decouple Side-Effects
const createListOfPosts_ = () => {
const PostsResponse = /* import */ PostsResponse_;
return fetch('/blog/posts').then((response) => {
return response
- .text();
+ .json();
}).then((
- htmlResponse
+ jsonResponse
) => {
return PostsResponse(
- htmlResponse
+ jsonResponse
).toHtmlList();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment