I found a html page with flower animations in it and trying to use it in my react app but I am not able to I think I am not able to properly pass the value to the custom css variables.
In html it is done like
<div class="grow-ans" style="--d:4s"></div>
in react I tried this :
<div className="grow-ans" style={{'--d':'4s'}}></div>
but it is not working.
I cant find anything else anywhere. Please help.
this is the code I am trying to convert into react component.
https://github.com/jeycaarce/flowers
2
Answers
To pass values to CSS variables from a functional component in React, you’re on the right track by setting the CSS variable using the style prop. However, there are a couple of things you need to keep in mind:
React uses camelCase for style property names. Therefore, you should use camelCase for CSS variable names as well.
You need to make sure that the CSS variable is used within your CSS or in a styled component for it to take effect.
in jsx use this
in CSS try this
try to use the same classNames and the same css folder into a component