Pantrypoints Pantrypoints

Templates

April 22, 2022 1 minutes  • 65 words

Data loading should never happen inside the template

Use functions instead of static variable assignments

As of Phoenix 1.7, HEEX tags can only be used in the body of the tag.

Explicitly precompute the assign outside of render:

assign(socket, sum: socket.assigns.x + socket.assigns.y)

Do not compute it withiin a static render

def render(assigns) do
	sum = assigns.x + assigns.y
	~H"""
		<%= sum %>
	"""
end
Follow Us! →

We're creating a new Economic System from a new Economic Science! Please support us by leaving your email or leaving a comment above.