How to show a Demographic

Let's learn how to show the response of a stateful component.

We'll cover the following

Our new component won’t do too much. It will just make the right details available for a user who has filled out a demographic. This component doesn’t need to respond to any events. All it needs to do is render the demographic details in some markup. A stateless component should do the trick here.

First, we’ll implement the component and its template. Then, we’ll render the component from within the SurveyLive LiveView. We’ll allow SurveyLive to handle the logic relating to the state of the overall survey—like whether to show the demographic form or the demographic details—while breaking out individual pieces of the survey page into their own smaller, more manageable parts. With this layering of components, LiveView allows us to build complex single-page flows with ease.

Get hands-on with 1400+ tech skills courses.