English 中文(简体)
Next JS Taildwind CSS navbar issue with option dropDown
原标题:

I m using this navbar

I created one component with navbar, the I m calling it on my src/app/page.tsx

"use client";
import Login from "../app/pages/login/page";
import Dashboard from "../app/pages/dashboard/page";
import { useAppSelector } from "./hooks/hooks";
import Header from "./components/layout/header";

export default function Home() {

  const userLogged = useAppSelector((state) => state.UserLogged.userLogged.onLine);

  return (
    <>
      { 
        userLogged?
          <>
            <Header />
            <Dashboard />
          </>
        :
          <Login /> 
      }       
    </>
  )
}

and I configure my layout.tsx, calling flowbite.min.js

  return (
      <html lang="en">
        <body>
            <Router>
              <Provider store={store}>
                {children}
              </Provider>
            </Router>   
            <script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.6/flowbite.min.js"></script> 
        </body>
      </html>
  )

so I follow the configuration of flowbite

so, the app run, perfect, but the option Dropdown on navBar is not working, what s wrong?? what I m doing wrong?

notice that this error started coming up when i added the <Provider store={store}>

I was testing it, if I remove tags Provider and Router of my layout.tsx file, like:

  <html lang="en">
    <body>          
        {children}   
        <script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.6/flowbite.min.js"></script> 
    </body>
  </html>

the option dropDown work: Image 1

but if I add tags Provider and Router of my layout.tsx file, like:

      <html lang="en">
        <body>          
            <Router>
              <Provider store={store}>
                {children}
              </Provider>
            </Router>   
            <script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.6/flowbite.min.js"></script> 
        </body>
      </html>

don t work the option dropDown: image 2

you can check on codesandbox.io

whe you in, click on "click here" and then you can see that the header dropdown is not working

问题回答

暂无回答




相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签