chrisui / babel-plugin-transform-react-binding Goto Github PK
View Code? Open in Web Editor NEWStop worrying about method/function binding!!
Stop worrying about method/function binding!!
Where we have locally bound immutable identifiers being referenced inside arrow function bodys within a render method we could pull out into memoized-context-bound functions.
This is important for functional components where arrow functions are the preferred way to do a syntax-friendly form of partial application.
See example: https://gist.github.com/Chrisui/fc2e1b20c54c4c5befb7abad9c6a577f
Currently we just look at any class with a render
method. Can't be this lazy in the real world! ;)
So in theory this plugin is great. We prevent the breaking of purity throughout our components transparently so should be able to avoid lots of re-renders without having to manually manage our bound functions and their references.
However, there is obviously some performance cost from doing the memoized bind so it would be good to have some very clear benchmarks which would demonstrate this and allow us to decide whether the optimisation is worth it or not.
These benchmarks should help:
Hey,
the current version of the npm package (0.1.2) does not contain the compiled version (lib/index.js), meaning any require of this package will fail.
Could you publish a new version w/ the compiled source please?
Thanks!
As it says on the tin.
Love this idea Chris! I'd like to fork and play with the code a bit, but am hesitant to do so without a LICENSE file. Would you be willing to add some sort of open source license? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.