skip to Main Content

I am very new to react and tailwind. Here is what i am trying to accomplish in pseudo code:

<Component className={aFunction(), 'some-tailwind-code'}></Component>

How would i accomplish this?

ive been trying to search around the internet but cant find anything because i cant word my question correctly.

2

Answers


  1. Well you can use clsx

    npm install --save clsx

    Import to your project
    import clsx from 'clsx';

    <Component className={ clsx(aFunction(), 'some-tailwind-code')}></Component>
    
    Login or Signup to reply.
  2. to accomplish what you want you can use clsx package to concatenate classNames.

    In your code, it would be :

    <Component className={clsx(aFunction(), 'some-tailwind-code')}></Component>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search