Create a Products Page with Gatsby and JSON

Поделиться
HTML-код
  • Опубликовано: 12 дек 2024

Комментарии • 4

  • @alannitro17
    @alannitro17 4 года назад

    Will this query json dynamically after you build the project? So if I run 'gatsby build' and then proceed to change the json somewhere inside the public folder; will that update the UI?

    • @ChrisDeSilva
      @ChrisDeSilva  4 года назад

      Great question! I haven't tried it, but I think you'd have to run 'gatsby build' again if you want to see your changes in the UI. Since that data is just being stored locally and isn't accessed from an endpoint, Gatsby wouldn't know that the data has changed.

    • @alannitro17
      @alannitro17 4 года назад

      Is there any way of getting data dynamically?

    • @ChrisDeSilva
      @ChrisDeSilva  4 года назад

      Definitely, you'd just set it up similarly to however you query data in a regular React app. Not sure exactly what you're looking to do but you can hit an API endpoint with fetch or axios somewhere in your app.