Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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