Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In ReactJS, I have a value stored in sessionStorage. How can I access that value in scss file? I need to apply some styles based on sessionStorage value using If condition

What I have tried:

I searched in lot of documentations on SCSS where I could not find any help on this. Unable to sort out this issue
Posted
Updated 22-Apr-21 22:32pm

1 solution

You can't. SCSS files will be processed on the server, and will return the generated CSS files to the client. The sessionStorage value only exists on the client.

Depending on what you're trying to do, maybe a CSS custom property could help?
Using CSS custom properties (variables) - CSS: Cascading Style Sheets | MDN[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900