skip to Main Content
import React from 'react'

const CustomButton = ({ type, title, customStyles, handleClick }) => { 
  return (
    <button
        className={'px-2 py-1.2 flex-1 rounded-md ${customStyles}'}
    >
        {title}
    </button>
  )
}

export default CustomButton

The customStyles keeps saying it’s declared but not being read. The customStyles is not being applied to the site, but everything else is. I don’t know what the problem is.

2

Answers


  1. Template literals are enclosed by the back-tick instead of single or double quotes.

    use className={`px-2 py-1.2 flex-1 rounded-md ${customStyles}`}

    Login or Signup to reply.
    • The issue is with how you are using template literals in the className attribute.
    • Use backticks (``) instead of single quotes ('') around the whole string.
    • like this
    className={`px-2 py-1.2 flex-1 rounded-md ${customStyles}`}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search