Go ProSign in

This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Hide playlist

    Scale Pixels for the Canvas with devicePixelRatio in React

    Joshua ComeauJoshua Comeau

    When working with HTML Canvas, HiDPI displays like Apple's Retina display require a bit of extra coaxing, to make sure they look crisp and sharp. This lesson covers how to write a method that automatically scales our component for the user's displays.

    Happily, once it's written, you can forget all about the DPI of your users' monitors. It's totally abstracted within our component.

    Learn more about creating the component here

    You must be a Member to view code