brainlid

brainlid

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!

Where Next?

Popular Frontend topics Top

First poster: bot
The Zen of index.html. Web development has become a very complex field with many branches and tools to master. In this article, I sugges...
New
First poster: bot
In JavaScript programs, asynchrony arises in situations such as web-based user-interfaces, communicating with servers through HTTP reques...
/js
New
First poster: bot
JavaScript allows calling a function with a different number of arguments than the expected number of parameters, i.e., one can pass fewe...
/js
New
CommunityNews
As JavaScript developers, the sheer amount of stuff we’re expected to know is enormous, and it grows bigger every day. With so many diff...
New
First poster: bot
Decided to write this blog post because I couldn’t find any documentation or online examples like the one I’m sharing here. Every example...
New
First poster: bot
The TypeScript type system is immensely powerful, and while the language itself is, of course, Turing complete, so is the type system its...
New
First poster: bot
JavaScript has come a long way since I knew it as the “D” in DHTML. For anyone like me, who’s been reluctant to use the latest syntax tha...
/js
New
First poster: rustkas
What is TCO? Tail-call optimization (TCO) is a very neat trick that the Elm compiler does to make recursive functions a lot more performa...
New
First poster: bot
In this article, we will look at the fascinating evolution of graphics in browsers from the prehistoric days of the early browsers. We wi...
/js
New
First poster: OvermindDL1
I have to admit: as I’ve watched Tailwind enthusiastically adopted by more and more of the frontend community, I’ve remained skeptical. B...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New