(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| String.prototype.replaceAll = function(search, replacement) { | |
| var target = this; | |
| return target.replace(new RegExp(search, 'g'), replacement); | |
| }; |
| output: { | |
| jsonpFunction: 'CUSTOMwebpackJsonp' | |
| }, |
| observeDOM(document.getElementsByTagName('head')[0], () => { | |
| console.log('head is changed'); | |
| }); |
| const arrayToObject = (array) => | |
| array.reduce((obj, item) => { | |
| obj[item.id] = item | |
| return obj | |
| }, {}) |
| module.exports = function (current, length, displayLength) { | |
| if (length <= 1) return [] | |
| displayLength = displayLength - 2 | |
| var indexes = [1] | |
| var start = Math.round(current - displayLength / 2) | |
| var end = Math.round(current + displayLength / 2) | |
| if (start <= 1) { | |
| start = 2 | |
| end = start + displayLength - 1 | |
| if (end >= length - 1) end = length - 1 |
| { | |
| "presets": ["es2015"], | |
| "plugins": ["transform-async-to-generator"] | |
| } |
| One solution is | |
| npm install --save-dev babel-plugin-transform-object-rest-spread | |
| and than create a .babelrc file in your project directory | |
| { | |
| "plugins": ["transform-object-rest-spread"] | |
| } |
| I use the first | |
| —– BEGIN LICENSE —– | |
| Michael Barnes | |
| Single User License | |
| EA7E-821385 | |
| 8A353C41 872A0D5C DF9B2950 AFF6F667 | |
| C458EA6D 8EA3C286 98D1D650 131A97AB | |
| AA919AEC EF20E143 B361B1E7 4C8B7F04 |
| //App.js: | |
| ... | |
| connect(mapStateToProps, { fetchData })(App) | |
| //ActionCreator: | |
| export const fetchData = () => (dispatch) => { | |
| dispatch({type: FETCHING_DATA}) | |
| getPeople() | |
| .then(data => dispatch({type: FETCHING_DATA_SUCCESS, payload: data})) | |
| .catch(er => dispatch({type: FETCHING_DATA_FAILURE})) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.