...

/

How to Initialize the SurveyResultsLive Component State

How to Initialize the SurveyResultsLive Component State

Let's learn how to fetch and render data in a LiveView.

Now, our application’s core contains all of the functions we need to fetch bar chart data in our LiveView. In this lesson, we’ll teach the SurveyResultsLive component to fetch this data put it in the state, and render it. Let’s get going.

Adding survey results to the component socket

We could add the survey result data to the parent LiveView’s mount/1 callback, but there’s a better ...