1

I have a react application in which on checking certain checkboxes I am adding or changing a certain image icon.

.checkbox1:checked ~ .icon-span {
   background: url('../../../../assets/images/icon_plus.svg');
}

Which is giving me this:

background: url([object Module]); //invalid property value

But path is correct, how do I correct this?

1
  • 4
    How have you configured Webpack do handle .svg files? Commented Nov 9, 2018 at 11:45

1 Answer 1

1

This should work .checkbox1:checked ~ .icon-span { background: url(${require("../../../../assets/images/icon_plus.svg")}); }

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.