How do you refer to a deeply nested component?

Take the two tweet buttons in the screenshot for example, I would like to focus on the tweet textarea when the user clicks on the big tweet button. How can this be done? Thanks!
5 Replies
thetarnav
thetarnav2y ago
event-bus for emitting and subscribing to events somewhere up the component tree. shared with context api in buttons you use the context and emit in the textarea you listen and .focus()
juliuskiesian
juliuskiesianOP2y ago
juliuskiesian
juliuskiesianOP2y ago
lots of event bus packages. could you recommend one? thx!
thetarnav
thetarnav2y ago
I would go for https://github.com/ai/nanoevents/blob/main/index.js becasue it's extremely simple
GitHub
nanoevents/index.js at main · ai/nanoevents
Simple and tiny (144 bytes) event emitter library for JavaScript - nanoevents/index.js at main · ai/nanoevents
juliuskiesian
juliuskiesianOP2y ago
👍
Want results from more Discord servers?
Add your server