This file contains 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
const bookBy = (author, book) => { | |
console.log(`${author} wrote ${book}.`); | |
}; | |
bookBy('Orson Scott Card', 'Ender\'s Game'); | |
// Orson Scott Card wrote Ender's Game. | |
bookBy('N. K. Jemisin', 'The Fifth Season'); | |
// N. K. Jemisin wrote The Fifth Season. |
This file contains 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
// App.jsx | |
import HomepageRow from 'dgx-homepage-row-component'; | |
import HomepageStaffPicks from 'dgx-homepage-staff-picks-component'; | |
import { gaUtils } from 'dgx-react-ga'; | |
const trackHomepage = gaUtils.trackEvent('Homepage'); | |
class App extends React.Component { | |
// ... | |
render () { |
This file contains 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
// App.jsx | |
import HomepageRow from 'dgx-homepage-row-component'; | |
import HomepageStaffPicks from 'dgx-homepage-staff-picks-component'; | |
import { gaUtils } from 'dgx-react-ga'; | |
const trackHomepage = gaUtils.trackEvent('Homepage'); | |
const trackHomepageRow = (action) => { | |
return (label) => { | |
return trackHomepage(action, label); | |
}; |
This file contains 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
// App.jsx | |
import HomepageRow from 'dgx-homepage-row-component'; | |
import HomepageStaffPicks from 'dgx-homepage-staff-picks-component'; | |
import FeatureRow from 'dgx-feature-row'; | |
import Banner from 'dgx-content-banner'; | |
import { gaUtils } from 'dgx-react-ga'; | |
const trackHomepage = gaUtils.trackEvent('Homepage'); | |
const trackHomepageRow = (action) => { | |
return (label) => { |
This file contains 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
const bookBy = (author) => { | |
return (book) => { | |
console.log(`${author} wrote ${book}.`); | |
}; | |
}; | |
const booksByRowling = bookBy('J. K. Rowling'); | |
booksByRowling('Harry Potter and the Sorcerer\'s Stone'); | |
// J. K. Rowling wrote Harry Potter and the Sorcerer’s Stone. | |
booksByRowling('Harry Potter and the Chamber of Secrets'); |
This file contains 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
bookBy('J. K. Rowling', 'Harry Potter and the Sorcerer\'s Stone'); | |
// J. K. Rowling wrote Harry Potter and the Sorcerer's Stone. | |
bookBy('J. K. Rowling', 'Harry Potter and the Chamber of Secrets'); | |
// J. K. Rowling and the Chamber of Secrets | |
bookBy('J. K. Rowling', 'Harry Potter and the Prisoner of Azkaban'); | |
// J. K. Rowling wrote Harry Potter and the Prisoner of Azkaban | |
// Etc. |
This file contains 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
// Previous way of importing the NYPL Header in package.json: | |
"dgx-header-component":"git+ssh://git@bitbucket.org/NYPL/dgx-header-component.git#master", | |
// Installing the npm Header and Footer: | |
$ npm install --save @nypl/dgx-header-component | |
$ npm install --save @nypl/dgx-react-footer | |
// NPM packages in package.json: | |
"dependencies": { | |
"@nypl/dgx-header-component": "1.4.1", |
This file contains 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
// We went from using React 0.13 and React Router 0.13 syntax: | |
import Router from 'react-router'; | |
// ... | |
app.use('/', (req, res) => { | |
let iso = new Iso(); | |
alt.bootstrap(JSON.stringify(res.locals.data || {})); | |
Router.run(routes.server, req.path, (Root, state) => { | |
const html = React.renderToString(<Root route={req.path} />); |
This file contains 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
// React Router v0.13 | |
<Route path="/" name="root" handler={Application}> | |
<Route path="blog" name="blogHome" handler={BlogsWrapper} /> | |
<!-- more routes --> | |
</Route> | |
// React Router v2.0 | |
<Route path="/" component={Application}> | |
<Route path="blog" component={BlogsWrapper} /> | |
<!-- more routes --> |
This file contains 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
// ES5 | |
const App = React.createClass({ | |
Mixins: [Navigation], | |
// ... | |
}); | |
// ES6 | |
class App extends React.Component { | |
// ... | |
} |