Hello,
i am currently trying to setup the homepage, but for some reason i can’t get the data for that from Wordpress, it seems to work on all other pages except for this one.
import React, { useEffect } from "react";
import { connect, styled } from "frontity";
import Link from "../link";
import List from "../list";
const HomePage = ({ state, actions, libraries }) => {
// Get information about the current URL.
const data = state.source.get(state.router.link);
// Get the data of the post.
const post = state.source[data.type][data.id];
// Get the html2react component.
const Html2React = libraries.html2react.Component;
//const BannerSlider = homepage.acf.banner_slider;
useEffect(() => {
actions.source.fetch("/");
List.preload();
}, []);
console.log(data.id) // This one is undefined.
// Load the post, but only if the data is ready.
return data.isReady ? (
<Content>
</Content>
) : null;
};
export default connect(HomePage);
const Content = styled.div`
background-color:blue;
`;
When i console.log the data:
{
isFetching: false,
isReady: true,
link: '/',
route: '/',
query: {},
page: 1,
type: 'post',
items: [
{ type: 'post', id: 15, link: '/coool/' },
{ type: 'post', id: 13, link: '/heeyyyy/' },
{ type: 'post', id: 1, link: '/hallo-welt/' }
],
total: 3,
totalPages: 1,
isArchive: true,
isPostTypeArchive: true,
isPostArchive: true,
isHome: true
}
There is no Id part here obviously thats where i need help i think there is some understanding issue for me somewhere down the line.