- Repo: https://github.com/insin/react-hn
- Live: https://react-hn.appspot.com (Version with forced offline caching at https://react-hn-rest.appspot.com)
- Detailed breakdown: https://gist.github.com/addyosmani/6e25174135f4f0095de77f07ecf068df
- Lighthouse: First meaningful paint (target value: 1,000ms) 100 (382.25ms)
- Lightouse: Speed Index (target value: 1,000) 98 (1330)
- Preact HN - a Preact version of this app is also available
import React, {Component, PropTypes} from 'react'; | |
class BadInputComponent extends Component { | |
static propTypes = { | |
text = PropTypes.string.isRequired, | |
updateText = PropTypes.func.isRequired, | |
}; | |
render() { | |
return ( |
import { createElement, cloneElement, Children } from 'react'; | |
import { TransitionMotion, spring, presets } from 'react-motion'; | |
import compose from 'recompose/compose'; | |
import defaultProps from 'recompose/defaultProps'; | |
import withHandlers from 'recompose/withHandlers'; | |
import toClass from 'recompose/toClass'; | |
const TransitionGroup = compose( | |
defaultProps({ | |
component: 'div', |
// 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 => { |
package main | |
import ( | |
"log" | |
"syscall" | |
"unsafe" | |
) | |
var ( | |
kernel32 = syscall.NewLazyDLL("kernel32.dll") |
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
/** | |
* Material UI multi select | |
* | |
* Use with: | |
* <MultiSelect fullWidth={true} value={this.state.values} onChange={(e,v) => this.setState({values: v})}> | |
* <ListItem primaryText={"Option 1"} value={1} /> | |
* <ListItem primaryText={"Option 2"} value={2} /> | |
* <ListItem primaryText={"Option 3"} value={3} /> | |
* <ListItem primaryText={"Option 4"} value={4} /> | |
* </MultiSelect> |
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...
Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they
/** | |
* Using Operator Mono in Atom | |
* | |
* 1. Open up Atom Preferences. | |
* 2. Click the “Open Config Folder” button. | |
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up. | |
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden! | |
* 5. Tweak away. | |
* | |
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png): |