Andrew Ek is a principal Engineer for LaunchScout, where he uses Elixir, Javascript, and Ruby to build software.
He otherwise spends most of his time helping other developers find more joy and satisfaction. Prior to being a software developer, he taught middle and high school language arts and math, and computer science at the collegiate level, and ran a non-profit where he taught poetry and taught other teachers how to teach poetry.
Andrew lives in Lincoln, Nebraska, USA, with his really excellent spouse and kiddo and their remarkably photogenic cats.
Level:
As happy as we are writing LiveView (very happy), sometimes the right choice is to use a third-party Javascript library. In this talk, we’ll look at the particular case of React components when:
Specifically, we’ll look at how to set it up so that we can work productively with minimal suffering (or accidental state clobbering). We’ll also see how the patterns we use for this particular case (both code organization and using Channels/sockets as the primary contact point, rather than Hooks) can be generalized to handle some fairly complex interactions and integrations regardless of whether we’re specifically using React or LiveView!
OBJECTIVES
The narrow focus of the talk is to give audience members the tools they need for situations like It sure would be nice if I could just bring [some react component] into this LiveVIew page
More broadly, we’ll lay out principles for how to build our systems in this way, and then we’ll see how the tools we use (for example, making the React component interact with the server over its own Channel/Socket instead of through the LiveView hooks interface) make our solutions incredibly portable.
There’ll also be just a bit about Pub/Sub and the broader “event-state reducer” pattern (which we see already in the various handle_info (etc.) callbacks that take an event and then return a data structure containing the new state.
AUDIENCE
This talk will be useful for full-stack developers, particularly those who are using or want to use LiveView and have enough complex needs that they need to reach for third party JS libraries.
It’s possibly useful to developers who don’t or won’t use LiveView but who want to go beyond the conventional request/response REST API (or GraphQL) interaction points and toward something more real-time.