Upload
joonas-lehtonen
View
263
Download
0
Embed Size (px)
Citation preview
Boring intro to Vue.js
“Vue.js is a library for building interactive web interfaces. It provides data-reactive components with a simple and flexible API”
source: github.com/vuejs/vue
Why should you care about Vue.js?
•Maybe you we’re disappointed with Angular 2•Maybe you think React is overly complex for most use cases•Maybe you just want to see what all the hype is about
Your average React starter kit• classnames• immutable• react• react-dom• react-redux• redux• redux-devtools• redux-devtools-extension• redux-form
• redux-immutable• redux-saga• redux-thunk• react-router• react-router-dom• react-router-redux• react-router-scroll• reselect• styled-components
export default function configureStore(initialState = {}, history) {
const middlewares = [sagaMiddleware,routerMiddleware(history),
];
const enhancers = [applyMiddleware(...middlewares),
];
const composeEnhancers =process.env.NODE_ENV !== 'production'
&&typeof window === 'object' &&window.__REDUX_DEVTOOLS_EXTENSION_COMPO
SE__ ?window.__REDUX_DEVTOOLS_EXTENSION_COM
POSE__ : compose;/* eslint-enable */
finalCreateStore = compose(applyMiddleware(...middleware),window.devToolsExtension ? window.devToolsExtension() :
DevTools.instrument(),persistState(window.location.href.match(/[?&]debug_session=([^&
]+)\b/)))(_createStore);
} else {finalCreateStore = applyMiddleware(...middleware)(_createStore);
}
const reducer = require('./modules/reducer');if (data) {
data.pagination = Immutable.fromJS(data.pagination);}const store = finalCreateStore(reducer, data);
if (__DEVELOPMENT__ && module.hot) {module.hot.accept('./modules/reducer', () => {
store.replaceReducer(require('./modules/reducer'));});
}
return store;
250 lines of boilerplate
Think of templates as an alternative way to declare your render functions
”But doesn’t that mean I have to separate my component’s logic from its presentation?”
React developer, what if I told you…
•…that you wouldn’t have to write a single shouldComponentUpdate function ever again• ...that you wouldn’t have to spend any more time thinking how to optimize component rendering
Summary
Vue.js steals borrows best ideas from other libraries
It’s not as interesting as some other alternatives(you might even call it boring)
But it helps you and your team get the job done
To get started
npm install –g vue-clivue init webpack-simple
Official documentation is very good.https://vuejs.org