This is to wish everyone Merry Christmas and Happy Holidays. This is done using Pure CSS
A Pen by Narendra N Shetty on CodePen.
This is to wish everyone Merry Christmas and Happy Holidays. This is done using Pure CSS
A Pen by Narendra N Shetty on CodePen.
const INITIAL_STATE = { | |
isLoaded: false, | |
data: [] | |
}; | |
function Store() { | |
this.state = INITIAL_STATE; | |
}; |
// List to hold all the subscribers | |
let subscribers = []; | |
// method used to subscribe for a state change | |
Store.prototype.subscribe = function(callback) { | |
subscribers.push(callback); | |
}; | |
// This method is used to trigger all the subscribers when the state is changed | |
Store.prototype.triggerSubscribers = function() { | |
subscribers.forEach((subscriber) => { | |
subscriber(this.state); |
const action = { | |
type, // specify the action type | |
data // optional data can be passed | |
}; | |
Store.prototype.dispatch = function(action) { | |
// based on the action type | |
// generate a new state of the application, | |
// by passing it to a reducer | |
const state = this.reducer(action); |
Store.prototype.reducer = function(action) { | |
// create a clone of the state | |
let state = Object.assign({}, this.state); | |
switch(action.type) { | |
case 'INIT': | |
state.data = action.data; | |
return state; | |
default: | |
return state; | |
} |
<Route path="home" name="home" getComponent={(nextState, cb) => { | |
require.ensure([], (require) => { | |
cb(null, require('../components/Home').default); | |
}, 'HomeView'); | |
}}> |
{ | |
'entry': { | |
'app': './src/index.js', | |
'vendor': [ | |
'react', | |
'react-redux', | |
'redux', | |
'react-router', | |
'redux-thunk' | |
] |
server.use((req, res)=> { | |
match({ | |
'routes': routes, | |
'location': req.url | |
}, (error, redirectLocation, renderProps) => { | |
if (error) { | |
res.status(500).send(error.message); | |
} else if (redirectLocation) { | |
res.redirect(302, redirectLocation.pathname + redirectLocation.search); | |
} else if (renderProps) { |
server.use('/static', expressStaticGzip('./dist/static', { | |
'maxAge': 31536000, | |
setHeaders: function(res, path, stat) { | |
res.setHeader("Expires", new Date(Date.now() + 2592000000).toUTCString()); | |
return res; | |
} | |
})); |
{ | |
'plugins': [ | |
new CompressionPlugin({ | |
test: /\.js$|\.css$|\.html$/ | |
}) | |
] | |
} |