zulfiya
zulfiya

Reputation: 91

Why Tailwind some classes don't work in React

I want to use Tailwind to style my app in React but some classes are not working, how can I fix it? And what would affect it?

function NavBar({ title }) {
  return (
    <nav className="navbar mb-12 shadow-lg bg-neutral text-neutral-content">
      <div className="container mx-auto">
        <div className="flex-none px-2 mx-2">
          <AiFillGithub />
        </div>
      </div>
    </nav>
  );
}

but on web page nothing changed.

Upvotes: 1

Views: 302

Answers (1)

zulfiya
zulfiya

Reputation: 91

I sorted out the problem, in file tailwind.config.js I had:

content:["./src/**/*.{html,js}", "./components/**/*.{html,js}"] 

and I should change for:

content: ["./src/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"]

I posted my solution just in case if someone will face the same problem

Upvotes: 4

Related Questions