# Buider.get model return empty array

**URL:** <https://forum.builder.io/t/buider-get-model-return-empty-array/6505>\
**Category:** Technical Questions\
**Tags:** react\
**Created:** [October 2, 2024, 3:49am UTC](https://forum.builder.io/t/buider-get-model-return-empty-array/6505 "2024-10-02T03:49:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qhyn](https://avatars.discourse-cdn.com/v4/letter/q/5daacb/32.png) [@Qhyn](https://forum.builder.io/u/Qhyn)\
**Post date:** [October 2, 2024, 3:49am UTC](https://forum.builder.io/t/buider-get-model-return-empty-array/6505/1 "2024-10-02T03:49:30Z")

</div>

Hi,  
I created a model page and one content page of this model and I’m trying to get the content page in vite+react but it’s returning an empty array.

Here is my model and page:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/9/9ad8e2ddc6c003be5b83b260d661b8b59489eda5.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/9/94b4d143b671dd1060795ce749fb603f2c05769e.png)

Here is my code:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/f/fd6e53923a1bd3ece991c752450372ac189f4bc8.png)

Here is query param in the request:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/0/0c2630ccb5ef10dc3e2d3fd081f906060f7dbf44.png)

Please help me find the problem. I’ve searched many topics but haven’t found a solution.

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [October 3, 2024, 9:51am UTC](https://forum.builder.io/t/buider-get-model-return-empty-array/6505/2 "2024-10-03T09:51:49Z")

</div>

Hello @Qhyn,

Welcome to the [builder.io](http://builder.io) forum post.  
Regrettably, we are unable to replicate the error on our end. Please ensure that you are using the correct builder API key.[→ Follow this link for instructions on finding your API key](https://www.builder.io/c/docs/using-your-api-key#finding-your-public-api-key)

```auto
import { useEffect, useState } from "react";
import { BuilderComponent, builder, useIsPreviewing } from "@builder.io/react";
import './App.css'
// Put your API key here
builder.init("Your API Key");

// set whether you're using the Visual Editor,
// whether there are changes,
// and render the content if found
export default function CatchAllRoute() {
  const isPreviewingInBuilder = useIsPreviewing();
  const [notFound, setNotFound] = useState(false);
  const [content, setContent] = useState(null);

  // get the page content from Builder
  useEffect(() => {
    async function fetchContent() {
      const content = await builder
        .get("page", {
          url: window.location.pathname
        })
        .promise();

      setContent(content);
      setNotFound(!content);

      // if the page title is found, 
      // set the document title
      if (content?.data.title) {
      document.title = content.data.title
      }
    }
    fetchContent();
  }, [window.location.pathname]);
  
  // If no page is found, return 
  // a 404 page from your code.
  // The following hypothetical 
  // <FourOhFour> is placeholder.
  if (notFound && !isPreviewingInBuilder) {
    return <h2>404....</h2>
  }

  // return the page when found
  return (
    <>
      {/* Render the Builder page */}
      <BuilderComponent model="page" content={content} />
    </>
  );
}

```

https://www.loom.com/embed/77739b894d74415ca4288c025a8f0323?sid=67b0f4e5-d5ce-4561-8b50-f02bdcc1a65c

Hope this helps!

Thanks,
