(Medium) - Decouple Side-Effects
View original- current
This article is too short to summarise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| const createListOfPosts_ = () => { | |
| const PostsResponse = /* import */ PostsResponse_; | |
| return fetch('/blog/posts').then((response) => { | |
| return response | |
| - .text(); | |
| + .json(); | |
| }).then(( | |
| - htmlResponse | |
| + jsonResponse | |
| ) => { | |
| return PostsResponse( | |
| - htmlResponse | |
| + jsonResponse | |
| ).toHtmlList(); | |
| }); | |
| }; |