Map list of content with React

Hi All and sorry if what I'm asking is really basic.

I am trying to map a list of content from Prismic on ReactJS but what I'm getting is a React error that say: " is not a function".

I'm pasting my code bellow if you can help me with this, please:


import './App.css';
import React, { state, useState, useEffect, Component } from "react";
import Prismic from '@prismicio/client';
import { Date, Link, RichText } from 'prismic-reactjs'

const apiEndpoint = ''
const accessToken = '' // This is where you would add your access token for a Private repository

const Client = Prismic.client(apiEndpoint)

const App = ()=> {
    const [doc, setDocData] = React.useState([]);
    React.useEffect(() => {
        const fetchData = async () => {
            const response = await Client.query(
      'document.type', 'page')
            if (response) {
    }, []);
    return (
       => (
                    <div key={user.uid}>

export default App;

Hello @Rola

Welcome to the Prismic community.

Can you try to add an if condition above your return statement something like:



If you are getting the complete map object and set correctly using React useState, it should work.

I's recommend you take a look at our React.js project: GitHub - prismicio/reactjs-blog

Let me know if you have any doubts.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.