Skip to content

Instantly share code, notes, and snippets.

@JonatanSalas
Created March 4, 2018 14:36
Show Gist options
  • Save JonatanSalas/fc371e4d0836c95b0068a148e2a8b9c8 to your computer and use it in GitHub Desktop.
Save JonatanSalas/fc371e4d0836c95b0068a148e2a8b9c8 to your computer and use it in GitHub Desktop.

Revisions

  1. Jonatan E. Salas created this gist Mar 4, 2018.
    8 changes: 8 additions & 0 deletions newsFetcher.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    import { createResource as createFetcher } from 'simple-cache-provider';

    const newsFetcher = createFetcher(async () => {
    const res = await fetch(`https://jsonplaceholder.typicode.com/posts`);
    return await res.json();
    });

    export default newsFetcher;