vendredi 17 avril 2020

Problem with for loop or fectching data with array in storybook component

I have installed bootstrap_storybook theme and started work with the storybook component. As of now, I am facing an issue with for loop while fetching data from stories.js file. I have added my code as per below:

code of my twig file:

<div>

Code of my stories.js file for fetching data

export const search_link = () => (
searchlink({
  attributes: new drupalAttribute(),
  plugin_id: "search_link",
  "searchitems": [
    {
      "link_url": "#abc",
      "link_content": "abc"
    },
    {
      "link_url": "#xyz",
      "link_content": "xyz"
    }
  ]
})  );

With the above code, data is not shown on the page but if I checked with the inspect element then the structure is rendered.

I tried with then it shows data with all key values in the array but when I tried to access data with any key value then I am not able to access data. Basically I am able to access the variable in twig file but not able to access key value from for loop. So I didn't get an idea about this such issue

So I have tried with just simple loop as bellow:


So it prints just * 10 times. but the number is not displayed.

Can anyone please help me with this? what is wrong in this or I missed anything. Please let me know

Also I have a posted this issue on d.o https://www.drupal.org/project/bootstrap_storybook/issues/3127772

Thanks,

Avani

Aucun commentaire:

Enregistrer un commentaire