CSS Custom Properties that Dynamically Update with React & JavaScript

CSS Custom Properties that Dynamically Update with React & JavaScript

Colby Fayock

2 года назад

17,087 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Vitor Hugo
Vitor Hugo - 06.05.2023 17:53

How can i export these value to set global color palletes?

Ответить
Anh Tuấn Lê
Anh Tuấn Lê - 25.03.2023 03:44

Tks so much. but it to down perfomance in app ?

Ответить
Ruddh Vindh
Ruddh Vindh - 10.09.2022 06:02

I watched this video and I subscribed. Great content, keep it up.

Ответить
Marlon Morales
Marlon Morales - 14.07.2022 19:12

Amazing, great job with this tutorial, it help me a lot

Ответить
Harish Sivaramakrishnan
Harish Sivaramakrishnan - 11.06.2022 13:11

Awesome one dude! But please turn on Word-wrap in your VScode , that'll make it even more easy for us to look at the code
Shortcut (Alt + Z)

Ответить
Dan
Dan - 06.06.2022 20:37

Perfect videos, thank you.

Ответить
Keenan Reed
Keenan Reed - 31.05.2022 23:35

Thanks, you're a lifesaver!

Ответить
Tuyen Khong
Tuyen Khong - 01.03.2022 20:59

Whats the benefit of this over using state and directly modify React Element ?

Wouldnt this be a bad practice as it directly modifies the DOM, which violates the principle of React.

Ответить
大盗江南
大盗江南 - 16.02.2022 02:45

Great video, thx buddy

Ответить
Amir Noorani
Amir Noorani - 13.01.2022 14:42

just Awesome

Ответить
Daily meow
Daily meow - 07.01.2022 19:35

Hey Colby, can i add animation in the :root{} and keyframes to a css variable ?

Ответить
Erin Kahn
Erin Kahn - 15.12.2021 16:54

I'm so glad I found your videos! You're a great teacher.

Ответить
Joseph Zimmerman
Joseph Zimmerman - 25.10.2021 17:49

I prefer not to do direct DOM manipulation with libraries like Vue or React if possible, so for something like this, instead of setting the style on the `documentElement`, I would put it right in the template/JSX as a style attribute on one of the elements:

`<svg style={'--color-logo': color}>...</svg>`

This, of course, requires a `useState` variable to hold the values and also requires you to have an appropriate element to put the styles on, so if the controlling component doesn't have access to the element that is getting controlled, then you'll need some type of global state.

Ответить
Inter Net
Inter Net - 22.10.2021 18:34

Just a tip, try to not put the same image of you in every thumbnail this makes some people think you upload old videos which = less views.

Ответить
Q The Coder
Q The Coder - 21.10.2021 05:40

To take this 1 step further, how would we implement this to a database for users? Basically, a user with a admin page can customer a look of something/thier page.

Ответить