Can't seem to acces post object data

Hi, recently iā€™ve started rebuilding my companyā€™s site with Frontity. Itā€™s my first time using React at all so still got a long way to go. Problem iā€™m having is that i can not for the life of me seem to access the data i need from an ACF post object field. The site has the following hierarchy:

  1. index.js which contains a component.
  2. sections.js which contains flexible content fields and two maps. the second map sents a ā€˜inhoudā€™ (content) prop to the next file. So weā€™ve got a top component and then a component.
  3. featuredpage.js which contains the actual component config.

In the featuredpage.js file iā€™m getting the content from the ā€˜inhoudā€™ prop. I then try to map over the actual featured pages, which does succeed. Iā€™m able to return the ID here and HTML. Using the below code i canā€™t seem to get the rest of the data like the URL which i need. I feel like thereā€™s something wrong with the state but i donā€™t know where to go from here. Logging thisPost returns undefined. Anyone able to help me out?

Featuredpage.js

import React, { useEffect } from 'react';
import { connect, styled } from 'frontity';
import Row from 'react-bootstrap/Row';

const Featuredpage = ({ state, inhoud, actions}) => {
    const { stijl, hoek, layout, paginas, title } = inhoud;
    return (
        <Row>
            {stijl &&
                <div className="col-12 my-5">
                    <h2>{stijl}</h2>
                </div>
            }
                {paginas && paginas.map((pagina, index) => {
                    const thisPost = state.source[pagina.post_type][pagina.id];
                    return (
                        <>
                            <h1>{pagina.ID}</h1>
                            {/* <h2>{thisPost.link}</h2> */}
                        </>
                    )
                })}
        </Row>
    )
}

export default connect(Featuredpage);
1 Like

Edited because I saw you mapped differently than I originally read.

Can you try logging what you are getting from paginas, and maybe generally from inhoud? Maybe you are not passing the prop correctly.

Hi Gideon, thanks for replying. Iā€™ve logged both inhoud and pagina, the response is seen in the screenshot below.

Inhoud does return the correct pages as seen by the object IDā€™s. Pagina does also return the right individual page as seen by the IDā€™s. I just canā€™t seem to access them by using the state.source.

Sorry for the late reply, I was out of town.
Not sure if youā€™ve figured it out yet, but you donā€™t appear to have a quality of ā€œidā€ under pagina. It is capitalized, so try:

const thisPost = state.source[pagina.post_type][pagina.ID]