@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {
/* First, install dependencies: | |
npm install webpack babel-loader babel-core babel-preset-react --save-dev | |
npm install react react-dom --save | |
Note: babel dependencies are not needed if you aren't using jsx) | |
*/ | |
// webpack.config.js | |
// Note: This assumes a "main.js" file in a src/ directory, and outputs "main.bundle.js" to a dist/ directory |
import { Match, Redirect } from 'react-router' | |
// With the way we use Redirect in this demo, the word "AddressBar" probably | |
// makes more sense! | |
const AddressBar = ({ url }) => ( | |
<Redirect to={url}/> | |
) | |
class InfniteArticleHomePage extends React.Component { |
@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
/** | |
* ReactJS: JavaScript like you've always done it. | |
* | |
* This example renders your top ten most followed friends/followers, `filter`ing | |
* only your favorites, and putting a star on all verified accounts. | |
* | |
* With ReactJS, any time your data changes, the UI is always brought up to date | |
* automatically. If friends length changes, or followCount - it always shows what | |
* `render` describes. | |
*/ |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
node_modules | |
*.swp |
js> isNaN(null); | |
false | |
js> null > -1; | |
true | |
js> null < 1; | |
true | |
js> null > 0; | |
false | |
js> null < 0; | |
false |