I see a typo in https://prisa.arcpublishing.com/alc/arc-products/pagebuilder/fusion/documentation/recipes/fetching-content-with-hooks.md?version=2.2
It's where define the transform property as an arrow function. Colon symbol and arrow are missing.
It should be:
...
const movies = useContent({
source: 'movie-search',
query: { movieQuery: 'Jurassic' },
filter: '{ totalResults Search { Title Year Poster } }',
transform: (data) => {
// Check if data is being returned
if(data && data.Search)
return { list: [...data.Search] };
// Otherwise just keep the current list of movies
else
return movies;
},
})
...
instead of:
...
const movies = useContent({
source: 'movie-search',
query: { movieQuery: 'Jurassic' },
filter: '{ totalResults Search { Title Year Poster } }',
transform (data) {
// Check if data is being returned
if(data && data.Search)
return { list: [...data.Search] };
// Otherwise just keep the current list of movies
else
return movies;
}
})
...
Australia's online home furnishing website, with many types and fashionable styles, decorate your room.
The shorthand method of defining the function is valid
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions
That's not a typo, it works.