Goal: Use gatsby-transformer-json to read data from a local JSON file and dynamically generate list items in a React component.
Use Case: I have a...
For further actions, you may consider blocking this person and/or reporting abuse
Great post, Emma š
I have found a mistake with explaining empty brackets in JSX. You are putting:
as the same as
which is not true.
The true equivalent is
I was unsure of this in the regard of whether or not it compiled to a
div
tag at runtime, in which case I'd say your comment would be a little nitpicky, since she probably knows this and assumes it's easier to say it's adiv
than having to explainFragment
, but it actually doesn't get compiled to anything. Essentially the same thing, though, sorta. Okay mini rant over.Query - I love GraphQL (recent convert!) but I'm curious why it was used here? Given that the JSON data was static, not an API, and was already in a simple to use format, what was the purpose of using GraphQL to "query" it? Wasn't it already in a form appropriate for driving your dynamic navigation?
Read about Gatsby. It's built for reusability (themes) and GraphQL powers that. If she would release her creation as a theme, a user could build their own json in their own data folder, and Gatsby would resolve it.
This is awesome Emma. I want to rewrite my personal site using Gatsby and this is gonna be super helpful!
Aw yay! <3
this was actually so helpful, thank you!! i was looking for a way do this all day!
Thank you, a very useful post that helped me better understand how to work with GraphQL!
Have you tried filtering on your query with this transformer plugin? I am trying to filter by a value and Iām not having any luck.
Here is a step by step guide about how to create your blog site using Gatsby.
zeptobook.com/create-your-blog-sit...
Hey Emma, if you need a GraphQL schema visualization tool take a look at graphqleditor.com/
Great post!