stample / atom-react Goto Github PK
View Code? Open in Web Editor NEWA pure JS wrapper around React
A pure JS wrapper around React
Hi, don't mean to be disrespectful or anything.
This project is kinda hard to google because there's Atom-the-editor and its plugins for React.
A single word name that doesn't clash with other projects would help IMO. Do you consider this?
rAF is sometimes a problem with form inputs, with a jumping cursor
Morearty/Om are using wrapper DOM items to solve this problem.
For exemple:
https://github.com/Tvaroh/moreartyjs/blob/f9f9a6fd81c8f77cc1877f6ede271bf9bb83580f/src/DOM.js
When a promise resolve, all the stores registering listeners to it should be updated atomically.
Can it be done with Q?
We should not try to call Perf in non-production envs
if ("production" !== process.env.NODE_ENV)
React libs tends to use mixins but it would be better to not use them anymore.
See
https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750
Instead of using mixins for shouldComponentUpdate we can just add the shouldComponentUpdate method if it is not defined by the user in this place:
function addMixins(config) {
config.mixins = config.mixins || [];
config.mixins.push(WithPureRenderMixin);
config.mixins.push(WithCursorLinkingMixin);
config.mixins.push(WithTransactMixin);
config.mixins.push(WithCommandPublisherMixin);
config.mixins.push(WithEventPublisherMixin);
config.mixins.push(WithEventListenerMixin);
}
function createPureClass(name,component) {
Preconditions.checkHasValue(name,"The name attribute is mandatory: this helps to debug compoennts!")
Preconditions.checkHasValue(component,"The config attribute is mandatory!")
Preconditions.checkCondition(!component.initialState,"Pure components should not have any local state, and thus no initialState attribute");
Preconditions.checkCondition(!component.shouldComponentUpdate,"shouldComponentUpdate is already implemented for you");
Preconditions.checkCondition(component.render,"render() must be implemented");
Preconditions.checkCondition(component.propTypes,"propTypes must be provided: this is the component interface!");
// Unfortunately, the displayName can't be infered from the variable name during JSX compilation :(
// See http://facebook.github.io/react/docs/component-specs.html#displayname
component.displayName = name;
// Because React's displayName is not easy to obtain from a mixin (???)
component.getDisplayName = function() { return name };
addMixins(component);
return React.createClass(component);
}
exports.createPureClass = createPureClass;
Also we want to abstract the use of React's context feature from the user as it is still undocumented, so we can add a method to get access to AtomReact context methods, probably by merging contextTypes required by AtomReact to contextTypes defined by the user.
Also it would be nice to work around the problem of JSX's displayName inference.
The fact that we use a custom class factory means that JSX can't infer the displayName anymore and to have a displayName it is required to use something like:
var Footer = AtomReact.createPureClass("Footer",{
...
});
Can we make the inference work wiith a custom class factory?
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.