alivedise / blog Goto Github PK
View Code? Open in Web Editor NEWPersonal blog
Personal blog
React is wrapping native dom event, but for reason it does not expose 'isComposing' for 'input' event. So what to be done here is checking evt.nativeEvent.isComposing
NOTE: this is firefox only attribute.
App is importing module A, which depends on module B.
In A's package it does not specify version of package B. (Using latest)
If module B is updated from version 0.0.1 to 0.0.2, then do
|yarn upgrade A| under App's folder, nothing will happen.
Well, I found this during debugging my Service.js
var a = function() {
return new Promise((resolve) => {
resolve('1', '2');
}
}
a().then((x, y) => {
console.log(x, y); // y is always undefined.
});
And there's no warning about it :/
So you will need to put all what you want to pass back in an array or object.
A component should only care about something it is tightly related to. There's no reason to pass down user account data in a clock component. Treat an entire desktop OS environment to be a big web application, would you give application A some data that is only needed by application B?
I know React will eventually ignore any change if the newly generated virtual DOM is the same as the current virtual DOM. However it is still wasting computing power on calculating something we already know it's not needed. Since we already know what could be avoided before the computing occurs, why not reduce it? This is an important computer science skill: avoid doing some calculation that you know it's unnecessary. For example, when we want to sort ages, we will know at first that all the age values are between 0~200; thus we know we can use Radix sort instead of a pure sorting algorithm.
Someone may say: you can use a helper in React.shouldComponentUpdate to know if the data is the same as the last data. However it's still doing deep compare and is expected to spend some time.
One of the biggest pros of Redux is you can see every event in the single dispatcher. However this is definitely can be done with other libraries. For example, if you are using pub/sub mechanism to do cross-component communications, you can print every pub/sub information in the pub/sub library. I am not sure why people thinks it can only be done with Redux.
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.