Last active
January 8, 2016 19:04
-
-
Save clintonhalpin/7a8223df2e0e23f3c0fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#stateless-functional-components | |
// Simpler Components - Stateless Functional Components | |
var MyComponent = function(dataOk) { | |
return( | |
<div className="ok">{dataOk}</div> | |
) | |
} | |
// ES6 Version | |
var MyComponent = ({dataOk}) => { | |
return( | |
<div className="component">{dataOk}</div> | |
) | |
} | |
// Or if your never going to fuck with arguments | |
var MyComponent = ({dataOk}) => ( | |
<div className="component">{dataOk}</div> | |
) | |
// If you want to pass functions into Simple Components go for it! | |
// const onClick = () => console.log('clicked!'); | |
var MyComponent = ({dataOk}) => ( | |
<div className="component">{dataOk}</div> | |
) | |
// Returns | |
// $$typeof: Symbol(react.element) | |
// _owner: null | |
// _self: null | |
// _source: null | |
// _store: Object | |
// key: null | |
// props: Object | |
// ref: null | |
// type: "div" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment