

Note: We're not saying React is the worst here. Consider the following live component:įunction UserHoroscope ( In React, we can achieve similar behavior in a more explicit way (so it'll serve as a great visual exercise) The approach towards it varies across JS frameworks - check out the above keywords regarding Angular, Ember, Knockout, or Svelte. Note: This feature is known by different names, including change tracking, reactivity, memoization, or observability. That's some cool out-of-the-box optimization. Since this happens on the server, it's only the actual changes that will ever take up bandwidth, saving you the effort needed to slim down JSON payloads in classic SPAs, e.g., by designingĬase-specific or flexible APIs. Templating engine that splits your template into static and dynamic parts, and then only re-evaluates dynamic parts to
#Phoenix liveview examples update
You see, if you update a single React prop or piece of React state, the whole component will re-render. If you think that assigns are "just" props and state, and the show is over, brace yourself. We'll examine a specific use case along with its solution in a moment. Needed to hold the assigns during their entire session. This is especially true considering we're on the server, and all connected users will claim the memory Stealing the spotlight from API layers, state managers, sagas, and browser-based test suites.Īt the same time, state management is undoubtedly a challenging task, and keeping memory usage under control is one of This is perhaps the biggest highlight of LiveView, Imagine all the moving parts that it would take to produce and fully test the client-side equivalent of assign.

Pick your plan: Basic ($4.99) Premium ($19.99) You're currently subscribed to plan.
