Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Pageable: The container could not be found. #43

Open
iamlorddop opened this issue Dec 22, 2023 · 0 comments
Open

Pageable: The container could not be found. #43

iamlorddop opened this issue Dec 22, 2023 · 0 comments

Comments

@iamlorddop
Copy link

iamlorddop commented Dec 22, 2023

I created React app and when I use Pageable its thrown a error: App.jsx:9 Pageable: The container could not be found.

Code example:

import { useState } from 'react'
import Pageable from 'pageable'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'

function App() {
  const [count, setCount] = useState(0)
  const pageable = new Pageable('#container', {
    childSelector: "[data-anchor]",
    anchors: [],
    animation: 700,
  });

  return (
    <> 
      <div id="container">
        <div data-anchor="Page 1" className='section'>
                    <div>
                      <a href="https://vitejs.dev">
                        <img src={viteLogo} className="logo" alt="Vite logo" />
                      </a>
                      <a href="https://react.dev">
                        <img src={reactLogo} className="logo react" alt="React logo" />
                      </a>
                    </div>
                    <h1>Vite + React</h1>
                    <div className="card">
                      <button onClick={() => setCount((count) => count + 1)}>
                        count is {count}
                      </button>
                      <p>
                        Edit <code>src/App.jsx</code> and save to test HMR
                      </p>
                    </div>
                    <p className="read-the-docs">
                      Click on the Vite and React logos to learn more
                    </p>
        </div>
        <div data-anchor="Page 2" className='section'>
                    <div>
                      <a href="https://vitejs.dev">
                        <img src={viteLogo} className="logo" alt="Vite logo" />
                      </a>
                      <a href="https://react.dev">
                        <img src={reactLogo} className="logo react" alt="React logo" />
                      </a>
                    </div>
                    <h1>Vite + React</h1>
                    <div className="card">
                      <button onClick={() => setCount((count) => count + 1)}>
                        count is {count}
                      </button>
                      <p>
                        Edit <code>src/App.jsx</code> and save to test HMR
                      </p>
                    </div>
                    <p className="read-the-docs">
                      Click on the Vite and React logos to learn more
                    </p>
        </div>
        <div data-anchor="Page 3" className='section'>
                    <div>
                      <a href="https://vitejs.dev">
                        <img src={viteLogo} className="logo" alt="Vite logo" />
                      </a>
                      <a href="https://react.dev">
                        <img src={reactLogo} className="logo react" alt="React logo" />
                      </a>
                    </div>
                    <h1>Vite + React</h1>
                    <div className="card">
                      <button onClick={() => setCount((count) => count + 1)}>
                        count is {count}
                      </button>
                      <p>
                        Edit <code>src/App.jsx</code> and save to test HMR
                      </p>
                    </div>
                    <p className="read-the-docs">
                      Click on the Vite and React logos to learn more
                    </p>
        </div>
      </div>

    </>
  )
}

export default App
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant