You can put your style object outside the render function. Or as static property of the function/class. otherwise you are gonna to recreate the same style each time
Thanks for commenting, You're totally right Pasquale! Ideally you can store your style variables really anywhere you want to and import them into your components.
However I did want to just show off a simple example that can also show props affecting styles.
We can also use useMemo to avoid recreating the same style on every render but I figured it was just a little out of scope for what I wanted to show :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.