컴포넌트 통신방법용 기본 앱 코드

  • App.svelte

<script>
import ButtonComponent from './buttonComponent.svelte'
</script>

<div class="penal">
  <h1>0</h1>
  <ButtonComponent  />
</div>

<style>
  .penal {
    padding: 20px;
    display:flex;
    flex-direction: column;
    justify-items: center;
    justify-content: space-around;
    align-items: center;
    height: 500px;
    width:400px;
    background: #e2e2e2;
    border: 1px solid #777777;
  }
</style>
  • buttonComponent

<script>
import { count } from '../store'
</script>

<button  >
  increment count []
</button>

[만들면서 배우는 Svelte]

Last updated