brainlid
Elixir Blog Post: Passing Unknown Attributes into Your Component
On your LiveView page, you are using a custom component. You want to be able to pass HTML attributes into the component, but the component doesn’t know anything about the attributes being passed! You need a way to pass arbitrary attributes through and get them where you want them.
I use lots of stateless LiveView components in my projects. A tip I learned makes it easier to keep components generic and reusable. Now written up as a recipe!
Most Liked
cblavier
Great post! I didn’t know about assigns_to_attributes/2!
We wrote a lot of live and stateless components and extracted some functions that helped us to make components extensible & reusable into a library:
1
Popular in Blog Posts
Posted via Devtalk (see this thread for details).
New
There is a new community resource available on writing “Safe Ecto Migrations”. When we get a migration wrong, it can lock up your product...
New
Hey there,
I’ve started a little blog series about building and deploying Elixir applications. Now I would like to share with you the f...
New
A little halloween hocus-pocus on the value proposition of having a reliable test suite in place.
You are not scared, are you?
New
Just finished a post for Embedded Elixir and I thought it should be cross-posted here:
I’ll update this thread as posts get published. ...
New
Elixir Blog Posts
How to use this section
You can post links to your blog posts either in one of the Official Blog Posts threads, or, vi...
New
Testing is an important part of any modern piece of software. But writing tests can quickly become an exercise in frustration, with tons ...
New
Just wrote a new blog post about how to deploy a Phoenix app using Kamal 2. Check it out and let me know what do you think:
New
Just published the first part of series of articles aimed to explain the architecture behind a kv-store engine written in Elixir and impl...
New
Hello all!
I wrote a blog post called Elixir Observability: OpenTelemetry, Lightstep, Honeycomb. The post post covers how to integrate ...
New
Other popular topics
can someone please explain to me how Enum.reduce works with maps
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New







