Problem reloading the page

Hello again :frowning: sorry to be so heavy and have so many doubts, but I am a true newbie in programming.

I share the problem in video format:

Does it have something to do with the map being executed before the state is updated and that is why it gives an error?

Some help? :frowning:

Thank you!

it seems you haven’t retrieved the data you’re tying to map over.

try this for instance and see if it helps for now

const data = state.source.get(state.router.link);
const post = state.source[data.type][data.id];  
...
...
return (data.isReady &&
  <div>
   { data.items.map.....
1 Like

I don’t know why, but with:

const data = state.source.get(state.router.link);

It does not retrieve the data from the state.

I have tried this way and it works:

const Projects = ({ state, actions }) => {
    const data = state.source.get('/');

    useEffect(() => {
        actions.source.fetch("/")
    }, []);

    return ( data.isReady &&

I don’t know if this is the best way to do it, but it works!

Thanks a lot for the help, you are the best! :smiley:

you may want to do a actions.source.fetch('/') in beforeSSR function in your site index.js so that it is available to begin with instead of having to do it in useEffect

1 Like