What is the best approach when passing Objects through props?

Hi all,

I want to fetch all of the custom taxonomies and show them on a page.
However when i pass them as Objects i can’t use .map for each of them. Do you know what would be the best approach to loop them? (see Screenshots)

Many thanks.
All the best,
Dejan


Hi @dejangeorgiev

You can loop over the keys in an object with something like:

Object.keys(myObject).forEach( key =>  {...})
1 Like

Hello @mburridge,

Thank you very much for the help. However i was able to fix it with .map function, just a different approach.

Do you have any idea how to get the taxonomy description and i am sure it is included in the api?

Many thanks.
All the best,
Dejan

Hi @dejangeorgiev

Glad you managed to fix your issue.

Regarding the description I can confirm that it is sent from the WP REST API, and also that it isn’t showing in frontity.state.

I’m not sure why, but I’ve referred this to the dev team. I’ll let you know as soon as I hear back from them.

1 Like

Hi @mburridge

Thank you so much.
Looking forward to hear from you regarding the taxonomy description.

Best,
Dejan

Hi @dejangeorgiev

As I said earlier, I referred this issue to our dev team. Here is what they replied:

1 Like

Hello @mburridge

Thank you very much for the resolution. However when i try with this approach the script runs an unlimited number of requests and eventually crashes. :frowning:

And when i try to fetch the data only with the taxonomy, can´t get the description either.

Thank you very much for helping out.
All the best,
Dejan

@dejangeorgiev

Do you have a github repo of your project so we can take a look at your code? Thanks.

Hi @mburridge

Here you go: https://github.com/dejangeorgiev/ruthgeorgiev-frontity

Please note that currently the API is not working as i am taking some actions on the hosting, so you might not be able to reproduce it. It will be available from Monday again.

Thank you very much.
Best
Dejan