Variable inside a component

  • gerson_ca-1372592391709659197

    Gerson CA

    2 days ago

    Hi I have this variable inside a component which is set with API data that I am sending via attributes. Then, on a list I am referencing the variable to display the data using the repeat option. This works fine in the component but on my main page I do not see the list data being rendered. Does it mean I have to move the variable up a level?
  • whitep4nth3r-1372594467609251979

    salma

    2 days ago

    There are a few ways to solve this. This page on contexts from the docs might help you decide which way to do it.

    You could choose to move the variable up a level. or send the data up with an event, or share it with a context.

    https://docs.nordcraft.com/contexts/overview
  • gerson_ca-1372601115622768681

    Gerson CA

    2 days ago

    Thanks for sharing but I’m still wondering if I were to share the data either via events or context, where would I set it in my main page? My list is inside my component so would I need to set another variable in the main page to display the data?
  • whitep4nth3r-1372604610660798464

    salma

    2 days ago

    It sounds like you want to define the variable on the main page and pass the variable data down into the component via an attribute
  • gerson_ca-1372692225976303638

    Gerson CA

    2 days ago

    Thanks this doc help I had to use the on attribute change event to update the data coming from the API
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
    👍1
  • whitep4nth3r-1372815184283963413

    salma

    1 day ago

    That’s great! The new docs are working!