Luis Matute

ReactJS jQuery

Communicate between components (ReactJS)

So I've been playing a lot with ReactJS lately and one of the problems I was facing was that I needed to comunicate from one component to another. They had different root components, so I couldn't pass the handlers between them. When the components can't communicate between any sort of parent-child relationship, the documentation recommends setting up a global event system. The solution I ended up using was a small snippet but rather elegant. I'm going to rely on JavaScript Events to create a small publish–subscribe pattern. If you have not used pub/sub before, its a messaging pattern…

Read More