PikoPong
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux
No Result
View All Result
PikoPong
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux
No Result
View All Result
PikoPong
No Result
View All Result
Home Web Dev

useStateInCustomProperties | CSS-Tricks

January 21, 2021
in Web Dev
286 6
useStateInCustomProperties | CSS-Tricks


In my recent “Custom Properties as State” post, one of the things I mentioned was that theoretically, UI libraries, like React and Vue, could automatically map the state they manage over to CSS Custom Properties so we could use that state right there if we wanted.

Someone should make a useStateWithCustomProperties hook or something to do that. #freeidea

Andrew Bloyce took me up on that idea.

It works just like I had hoped. The hook returns a component that is the Custom Property “boundary” and any state you pass it is mapped to those custom properties. Basic demo:

This is clever and useful already, but I’m tellin’ ya, this will be extremely useful should the concept of higher level custom properties land. The idea is that you could flip one custom property and have a whole block of styling change, which is is what we already enjoy with media queries and you know how useful those are.



Source link

Share219Tweet137Share55Pin49

Related Posts

Web Components Are Easier Than You Think
Web Dev

Web Components Are Easier Than You Think

When I’d go to a conference (when we were able to do such things) and see someone do a...

March 8, 2021
Going Beyond The Basics — Smashing Magazine
Web Dev

Obscure Mobile Design Techniques That Boost UX — Smashing Magazine

About The AuthorGert Svaiko is a professional copywriter and mainly works with digital marketing companies in the US and...

March 8, 2021
Invoker–the no-bull Laravel tool | Laravel News
Web Dev

Invoker–the no-bull Laravel tool | Laravel News

Invoker by Beyond Code lets you access all your Laravel applications with an instant admin panel—locally, via SSH and...

March 8, 2021
Laravel Tutorial: Step by Step Guide to Building Your First Laravel Application
Web Dev

Laravel Tutorial: Step by Step Guide to Building Your First Laravel Application

Since its initial release in 2011, Laravel has experienced exponential growth. In 2015, it became the most starred PHP...

March 7, 2021
Next Post
When To Say No To Freelance Projects — Smashing Magazine

When To Say No To Freelance Projects — Smashing Magazine

Servers: Cool Once Again | CSS-Tricks

Servers: Cool Once Again | CSS-Tricks

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

When Sass and New CSS Features Collide

When Sass and New CSS Features Collide

June 29, 2020
Optimize images with Thumbor

Optimize images with Thumbor

May 25, 2020
Scale your cloud data warehouse and reduce costs with the new Amazon Redshift RA3 nodes with managed storage : idk.dev

Scale your cloud data warehouse and reduce costs with the new Amazon Redshift RA3 nodes with managed storage : idk.dev

August 18, 2020
PHP Callable Fake Library – Laravel News

PHP Callable Fake Library – Laravel News

May 23, 2020

Categories

  • AWS
  • Big Data
  • Database
  • DevOps
  • IoT
  • Linux
  • Web Dev
No Result
View All Result
  • Web Dev
  • Hack
  • Database
  • Big Data
  • AWS
  • Linux

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In