Change font size in REACT dynamically

Change font size in REACT dynamically
0

#1

Hello, I am new to React and trying to make my first app.
I would like to change the font size (and border width and color eventually) of my text dynamically, to load it from variable that is constantly changing.
In my example: https://repl.it/@DavidVendel/HoneydewPointedInternalcommand I want font size to be the same as temperature.

I am failing for hours to come across the solution, can someone help me?
Thank you


#2

If the temperature is 17.8, you want the font-size of some element to be 17.8px?


#3

yes.
and since temperature changes every 50ms I want fontsize to change as well with it.
I just am not able to pass variable to style :frowning:


#4

I will also want to change text color with temperature (blue to red…) functionally.
And have a bar who’s height will represent in pixels amount of temperature… I need it for my first real project.


#5

I managed to do it finally.
Bug was in a fact that temp was string and to fontSize, number is required.
This thread an be deleted.