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
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()
lots of event bus packages.
could you recommend one? thx!
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
👍