aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/site.tag
blob: 2ced5904e56b6446bcef6ab3ca2daac142e3e32d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<site>
  <h1>List of posts</h1>
  <div each={ posts }>
    <post title={title} author={author} />
  </div>

  <script type="es6">
    import get from '../api';
    import post from './post';
    this.posts = [];

    const updatePosts = async () => {
      const posts = await get('/posts');
      this.update({posts});
    };

    updatePosts();

  </script>
</site>