{ response.json().then((json) => { question_list = json; }); }); } get_question_list();
<script>
let question_list = [];
function get_question_list() {
fetch("<http://127.0.0.1:8000/api/question/list>").then((response) => {
response.json().then((json) => {
question_list = json;
});
});
}
get_question_list();
</script>
<ul>
{#each question_list as question}
<li>{question.subject}</li>
{/each}
</ul>
{#if 조건문1}
<p>조건문1에 해당하면 실행</p>
{:else if 조건문2}
<p>조건문2에 해당하면 실행</p>
{:else}
<p>조건문2에 해당하면 실행</p>
{/if}
{#each list as item, index}
<p>순서: {index} </p>
<p>{item}</p>
{/each}
{객체}
{객체.속성}