1. 程式人生 > >[React] Work with HTML Canvas in React

[React] Work with HTML Canvas in React

pil nbsp sso spl des automatic monit related overflow

React‘s abstraction over the DOM means that it‘s not always obvious how to do DOM-related things, like working with the HTML Canvas API.

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.

[React] Work with HTML Canvas in React