Programming Phoenix LiveView: Build a Simple Function Component

The beginning of the “Use the Component” section instructs readers:

Alias the component in SurveyLive by adding this line to the top your module: alias __MODULE__.Component

It doesn’t say which file to put this in, though. I thought it was supposed to go in ../survey_live/component.ex because that was the file I was just working in. A little confusion that could be avoided by saying to put it in ..live/survey_live.ex.

Hi and thanks so much for your feedback! You’ll notice that just below that statement is the code sample that shows the alias code. That code sample starts with a header that specifies the file. That’s how we present many code samples in this book: the first line is a a banner/header that shows the filename that the code sample is from.