Giter VIP home page Giter VIP logo

vue-tricks's Introduction

vue-tricks

Advantages over reactjs:

  • Cleaner code (separetion between logic and view)
  • Code is intuitive
  • Handling state in react could be really a pain in the ass: https://stackoverflow.com/questions/46185343/react-rerenders-whole-component-when-its-properties-change
  • Vue automatically updates input state, no need to overhead code with "<input onChange" to apply changes from input.
  • wtf is that reactjs stacksize of about 110 calls for update action.
  • When react crashes, components just dissapear ( i mean no divs in html are present). Impossible to view the current html state after that
  • Say hello to ecosystem, and different extensions to react-chrome and react-redux (that requires tinkering to get it work). Yeah, guess what happens when react crashes? Correct, it displays nothing!
  • shouldComponentUpdate tells you anything? aha components should be reactive and not longer than 5 lines of code. Have you really seen it in huge enterise? Say hello to 500 lines jsx template and flashing green <body on simple textinput
  • react doesn't have single file components, and even is some not known libs support it, your favorite IDE will go crazy about it. So what, who needs SFC? Tell me that when you start importing css files to jsx and end up with coupled together css/js across different component in huge enterpice reactproject
  • no v-model attribute, what do you need to update prop on parent, Yeah correct go proxy
  • Redux complexity, no comments... Yeah you can go with different libs like graphql/mobx, is that what happens when you come to the project that has rect?. Oh yeah add saga to separate the code it becomes more intuitive (*joke)
  • vuex-module-decorators, vue-property-decorator, simplifies the code even more, than declaring state in react with static init, or having it in constructor
  • Scoped css, any alternative in react, go watch for duplicates in your css imports across all files
  • Template tag, v-for, v-show, v-show, v-if- v-else-if (hello do expression tc39 stage 1) having html exatly as it is, don't need to change classNames and etc, computed props (yeah go declare it twice from state), watch property
  • Pipes v-on:submit.prevent=, creating own attributes, custom pipes.
  • Different types of class declaration out of the box, string, array, object.
  • v-show on components are lazy out of the box, try hard that with virtual dom, yeah the truth hurts.
  • Mutliples slots ( react children only has one)
  • vue 3 supports ts out of the box,
  • css transitions out of the box (automatic class triggering and detecting appropriate timings)

Hello redux, that's 1 step in vuex:

moving from setState to redux steps:

  1. jsx : add this.props.exportSurveyModalShown

  2. mapStateToProps mapStateToProps exportSurveyModalShown 3)actions: const EXPORT_SURVEY_MODAL_VISIBILITY

  3. actions: export function exportSurveyModalVisibility(data) { return { type: EXPORT_MODAL_VISIBILITY, data, }; }

  4. actions: export function exportSurveyModal() { return (dispatch) => { dispatch(exportModalVisibility(true)); } }

  5. import {exportGradebook, exportSurveyModal} from "../actions";

  6. connect(mapStateToProps, {exportSurveyModal})(ExportButton);

  7. this.props.exportSurveyModal()

  8. reducers: const exportSurveyModalShown = (state=false, action) => { switch (action.type) { case EXPORT_MODAL_VISIBILITY: return action.data; default: return state; } };

  9. reducers const uiState = combineReducers({setupWizardShown, exportModalShown, switchDashboardEnabled, exportSurveyModalShown});

  10. combineReducers ({..., uiState})

vue-tricks's People

Contributors

akoidan avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.