I'm looking to make a reusable Component, each one subscribing to a different topic. In the code examples, the subscribe function is hard-coded to a particular topic. How can I dynamically do this? Say I have an array of topics, and I wanted to do a .map() function that creates a component using subscribe(). What's the recommended way of providing the topic to the component I'm instantiating?
I'm looking to make a reusable Component, each one subscribing to a different topic. In the code examples, the subscribe function is hard-coded to a particular topic. How can I dynamically do this? Say I have an array of topics, and I wanted to do a .map() function that creates a component using subscribe(). What's the recommended way of providing the topic to the component I'm instantiating?