Author: Chris Lattner
# From .NET Core 3.0 you can use the command: `dotnet new gitignore` to generate a customizable .gitignore file | |
*.swp | |
*.*~ | |
project.lock.json | |
.DS_Store | |
*.pyc | |
# Visual Studio Code | |
.vscode |
/* ========================= ES5 中的 arguments ====================== */ | |
// 在 ES5 中,一个函数内的 arguments 关键字可以获取该函数在调用时受到的所有参数 | |
function foo() { | |
// get arguments of a function | |
for (var i = 0; i < arguments.length; i++) { | |
console.log(arguments[i]); | |
} | |
} |
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property. You should ensure that your DOM elements do not have spurious props floating around.
There are a couple of likely reasons this warning could be appearing:
-
Are you using
{...this.props}
orcloneElement(element, this.props)
? Your component is transferring its own props directly to a child element (eg. https://facebook.github.io/react/docs/transferring-props.html). When transferring props to a child component, you should ensure that you are not accidentally forwarding props that were intended to be interpreted by the parent component. -
You are using a non-standard DOM attribute on a native DOM node, perhaps to represent custom data. If you are trying to attach custom data to a standard DOM element, consider using a custom data attribute (https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes).
-
React does not yet reco
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py | |
$ cd <download location> | |
$ sudo -H python ./get-pip.py | |
Installing pip also installs Python3 | |
To run Python3 | |
$ python3 | |
Install pip3 by just executing the same file as in the step above, but this time using Python3 | |
$ sudo -H python3 ./get-pip.py |
package com.segmentfault.app.view; | |
import android.content.Context; | |
import android.support.v4.view.MotionEventCompat; | |
import android.support.v4.view.NestedScrollingChild; | |
import android.support.v4.view.NestedScrollingChildHelper; | |
import android.support.v4.view.ViewCompat; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; |
Note: if you want to skip history behind this, and just looking for final result see: rx-react-container
When I just started using RxJS with React, I was subscribing to observables in componentDidMount
and disposing subscriptions at componentWillUnmount
.
But, soon I realised that it is not fun to do all that subscriptions(that are just updating property in component state) manually, and written mixin for this...
Later I have rewritten it as "high order component" and added possibility to pass also obsarvers that will receive events from component.