Open tiagomota79 opened 2 years ago
Hi, I had the same issue.
I found out that the solution is to add some lines to the graphql query in this file/frontend/utils/api.js
.
The query is inside the function getPageData
For example, I created the component Hello
with a custom property mydescription,
so I updated the query by adding:
... on ComponentSectionsHello {
id
mydescription
}
In general, the instructions are mostly wrong. The correct steps are:
/frontend/components/sections
sectionComponents
object inside the file /frontend/components/sections.js
to link the React component to Strapi/frontend/utils/api.js
inside the function getPageData
to add the component data you want to retrieve from StrapiContent-Type Builder > Components > Sections
and click on Create new component
Content-Type Builder > Collection Types > Page
scroll to contentSections
and click on Add a component
Using this starter.
I've followed the instructions to add a new section. It doesn't work - the new component will "render", but it receives no data other than the component name (
__typename: "ComponentSectionsDuoContent"
).My first instinct was that the query should be updated. So I updated the query in![image](https://user-images.githubusercontent.com/45611789/173897478-48a01214-cb17-4630-b6b3-b5c725c1eb93.png)
utils/api.js
to include my new section. It now won't render anything, giving this error:Steps to reproduce:
getPageData
inutils/api.js
, following the same structure as the existing sections in the query. The new query can even be an empty object, just... on ComponentSectionsYourComponentName {}