title: Livewire throwing error when using paginated data
body: <p>So I am being given this error when trying to paginate my data and send it in to a view through a livewire component.</p>
  <p>I am trying to get all posts and display at max 5 posts per page using pagination in laravel.</p>
  <p>Livewire version: 2.3.1<br>
  Laravel version: 8.13.0</p>
  <p><strong>Error:</strong></p>
  <pre><code>Livewire\Exceptions\PublicPropertyTypeNotAllowedException
  Livewire component's [user-posts] public property [posts] must be of type: [numeric, string, array, null,
  or boolean]. Only protected or private properties can be set as other types because JavaScript doesn't
  need to access them.
  </code></pre>
  <p><strong>My Component:</strong></p>
  <pre><code>&lt;?php
  
  namespace App\Http\Livewire;
  
  use Livewire\Component;
  use App\Models\Post;
  use Livewire\WithPagination;
  
  class UserPosts extends Component
  {
      use WithPagination;
  
      public $posts;
      public $type;
      protected $listeners = ['refreshPosts'];
  
  
  
      public function delete($postId)
      {
          $post = Post::find($postId);
          $post-&gt;delete();
          $this-&gt;posts = $this-&gt;posts-&gt;except($postId);
      }
  
      public function render()
      {
          if($this-&gt;type == 'all')
              $this-&gt;posts = Post::latest()-&gt;paginate(5);
          else if($this-&gt;type == 'user')
              $this-&gt;posts = Post::where('user_id',Auth::id())-&gt;latest()-&gt;paginate(5);
          return view('livewire.user-posts', ['posts' =&gt; $this-&gt;posts]);
      }
  }
  </code></pre>
  <p><strong>My Blade:</strong></p>
  <pre><code>&lt;div wire:poll.5s&gt;
      @foreach($posts as $post)
          &lt;div style=&quot;margin-top: 10px&quot;&gt;
              &lt;div class=&quot;post&quot;&gt;
                  &lt;div class=&quot;flex justify-between my-2&quot;&gt;
                      &lt;div class=&quot;flex&quot;&gt;
                          &lt;h1&gt;{{ $post-&gt;title }}&lt;/h1&gt;
                          &lt;p class=&quot;mx-3 py-1 text-xs text-gray-500 font-semibold&quot;
                             style=&quot;margin: 17px 0 16px 40px&quot;&gt;{{ $post-&gt;created_at-&gt;diffForHumans() }}&lt;/p&gt;
                      &lt;/div&gt;
                      @if(Auth::id() == $post-&gt;user_id)
                          &lt;i class=&quot;fas fa-times text-red-200 hover:text-red-600 cursor-pointer&quot;
                             wire:click=&quot;delete({{$post-&gt;id}})&quot;&gt;&lt;/i&gt;
                      @endif
                  &lt;/div&gt;
                  &lt;img src=&quot;{{ asset('image/banner.jpg') }}&quot; style=&quot;height:200px;&quot;/&gt;
                  &lt;p class=&quot;text-gray-800&quot;&gt;{{ $post-&gt;text }}&lt;/p&gt;
                  @livewire('user-comments', [
                      'post_id' =&gt; $post-&gt;id,
                      'type' =&gt; 'all'
                      ],
                      key($post-&gt;id)
                  )
              &lt;/div&gt;
          &lt;/div&gt;
      @endforeach
          {{ $posts-&gt;links() }}
  &lt;/div&gt;
  
  </code></pre>