generator functions – Devstyler.io https://devstyler.io News for developers from tech to lifestyle Fri, 24 Apr 2020 18:51:54 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 Crank.js was Born – for Creating JSX-driven Components https://devstyler.io/blog/2020/04/24/crank-js-was-born-for-creating-jsx-driven-components/ Fri, 24 Apr 2020 18:30:58 +0000 https://devstyler.io/?p=10950 ...]]> Crank.js – a new framework for creating JSX-driven components with functions, promises and generators was born. Crank uses the same JSX syntax and diffing algorithm popularized by React, allowing developers to write HTML-like code directly in your JavaScript.

All components in Crank are just functions or generator functions. No classes, hooks, proxies or template languages are needed.

The brand new platform also provides first-class support for promises. Crank.js allows using async/await directly in components, and race components to display fallback UIs.

“By combining these relatively old, almost boring technologies with JSX syntax, I think I’ve created a new way to write components, a way which is more expressive, easier to reason about, and more composable than any of the solutions the other frameworks have provided. But perhaps it’s wrong to say I “created” it. In a sense, Crank is not “just another web framework,” but a design pattern which would eventually have been discovered by the JavaScript community anyways,” the creators stated.

If you are curious about the idea and the reason why Crank.js was created, you can read the full article on the Crank.js creators blog.

Crank is available on GitHub  and NPM in the ESModule and CommonJS formats.

]]>