1

I have the following div -

 <div className={classes}>

classes is some variable that has some string value.

const classes = 'constant-className'

i want to add the string 'added-classNamme' after the current className so that the final className becomes:

 'constant-className added-classNamme' 

How can this be achieved??

I tried with <div className={classes + 'added-classNamme'}> but it's not working.

1 Answer 1

2

You can use it like:

<div className={`${classes} added-classname`}>

Refer template literals.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.