Skip to content
This repository has been archived by the owner on May 3, 2018. It is now read-only.

Dynamic Component Instantiation #1309

Open
falecci opened this issue Jun 26, 2017 · 1 comment
Open

Dynamic Component Instantiation #1309

falecci opened this issue Jun 26, 2017 · 1 comment

Comments

@falecci
Copy link

falecci commented Jun 26, 2017

Hi,

I have the following scenario. I have a list of categories. Whenever I click one, I make an ajax request to get its subcategories. After that, I should render another list with the subcategories, which then, of course, can have subcategories.

This could led up to something like this:

Electronics -> Computers -> Notebooks -> HP -> Accessories.

The only way I can imagine of doing this, is creating a component for the list of items, and creating a new instance whenever I click one category and have subcategories.

Is there any other way of doing it? if not, how could I create a new instance of a component everytime after I make a request?

Thanks!

@FluksikartoN
Copy link

FluksikartoN commented Jan 17, 2018

Well use render function and recursion. basically you have component that renders list which list items can be clicked. so render recursively the same component which component structure is based on nested object.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants