Vue.js vs. React.js: Comparing Two JavaScript UI Component Libraries

  • At a time where large MVC (model-view-controller) frameworks were cutting edge, two-way data binding was considered a feature, and SSR was mostly used for static webpages, React reversed the trend, focusing on building applications from encapsulated view components, one-way data binding, and using SSR on dynamic web pages via the…
  • Dependency tracking gives Vue’s virtual DOM a slight edge over React out of the box, because it can selectively re-render the child components that are actually affected by a change in state by default — no additional coding required.
  • In React, JSX breaks with the convention of keeping JavaScript and HTML separate, by providing a declarative XML-like syntax that allows you to create self-contained UI components that encapsulate all the instructions required to render them within the view: – – The React code above will render into a simple…
  • Under the React umbrella, we have Flux, the application architecture pattern Facebook developed as a state management solution to avoid issues like the infamous phantom unseen message bug, and Redux, a framework agnostic library for providing a simplified implementation of the Flux pattern, which replaces MVC (model-view-controller).
  • Both Vue and React are cutting edge UI component libraries that make use of a virtual DOM, embrace the components based future of web development, support SSR, and Universal JavaScript.

In this article, we’ll explore some of the key differences between the React.js and Vue.js JavaScript libraries, and learn which might be the best fit for your next web project.
Continue reading “Vue.js vs. React.js: Comparing Two JavaScript UI Component Libraries”

MobX (with Decorators) in create-react-app

MobX (with Decorators) in create-react-app  #MobX #ReactJS

  • If you are using create-react-app as your application boilerplate, you most likely run into the questions of how to setup MobX and how to use decorators in create-react-app.
  • After scaffolding your application with create-react-app on the command line, you can install mobx and mobx-react: – – Whereas the former is used as your state management solution, the latter is used to connect the state layer to your React view layer.
  • The current situation is that the maintainers of create-react-app are holding decorators back until Babel supports them in a stable stage: – – But what if you want to use decorators for your create-react-app + MobX application right now?
  • Fortunately there exists one sample project that already demonstrates how to use MobX with decorators in a Next.js application.
  • After showing all these different alternatives, using MobX with or without decorators in a plain React, a create-react-app or Next.js application, you have no excuse anymnore to give MobX as alternative to Redux a shot.

Everything to know about using MobX with and without decorators in a create-react-app with React. MobX doesn’t need necessarily decorators. But you can activate them by ejecting your application …
Continue reading “MobX (with Decorators) in create-react-app”

8 things to learn in React before using Redux

8 things to learn in #ReactJS before using #Redux:

  • A component can manage a whole lot of state, pass it down as props to its child components and pass a couple of functions along the way to enable child components to alter the state in the parent component again.
  • Component A is the only component that manages local state but passes it down to its child components as props.
  • In addition, it passes down the necessary functions to enable B and C to alter its own state in A.

    Now, half of the local state of component A is consumed as props by component C but not by component B.

  • When you lift the local state management down to component C, all the necessary props don’t need to traverse down the whole component tree.
  • When a library such as Redux “connects” its state managements layer with React’s view layer, you will often run into a higher order component that takes care of it (connect HOC in react-redux).

Facts about React that should be known before using Redux (or MobX). Most important: Learn React first, then opt-in Redux…
Continue reading “8 things to learn in React before using Redux”

8 things to learn in React before using Redux

  • A component can manage a whole lot of state, pass it down as props to its child components and pass a couple of functions along the way to enable child components to alter the state in the parent component again.
  • Component A is the only component that manages local state but passes it down to its child components as props.
  • In addition, it passes down the necessary functions to enable B and C to alter its own state in A.

    Now, half of the local state of component A is consumed as props by component C but not by component B.

  • When you lift the local state management down to component C, all the necessary props don’t need to traverse down the whole component tree.
  • When a library such as Redux “connects” its state managements layer with React’s view layer, you will often run into a higher order component that takes care of it (connect HOC in react-redux).

Facts about React that should be known before using Redux (or MobX). Most important: Learn React first, then opt-in Redux…
Continue reading “8 things to learn in React before using Redux”

8 things to learn in React before using Redux

  • A component can manage a whole lot of state, pass it down as props to its child components and pass a couple of functions along the way to enable child components to alter the state in the parent component again.
  • Component A is the only component that manages local state but passes it down to its child components as props.
  • In addition, it passes down the necessary functions to enable B and C to alter its own state in A.

    Now, half of the local state of component A is consumed as props by component C but not by component B.

  • When you lift the local state management down to component C, all the necessary props don’t need to traverse down the whole component tree.
  • When a library such as Redux “connects” its state managements layer with React’s view layer, you will often run into a higher order component that takes care of it (connect HOC in react-redux).

Facts about React that should be known before using Redux (or MobX). Most important: Learn React first, then opt-in Redux…
Continue reading “8 things to learn in React before using Redux”

A MobX introduction and case study

  • Actions modify the state, which triggers reactions.
  • Overall, we are very happy with the transition to MobX and would recommend investigating it if you are looking for a state management solution, especially if you are using TypeScript or Flow.
  • To use the previous example, if I wanted to display a banner after adding a client in that component I could set this.client = true and render something different when this.client is true.
  • Both name and numberPeople are observable properties of the thisMeetup object but only numberPeople is used in the autorun function.
  • Another neat thing about using MobX for state is that changes will be logged if you are using dev tools.

We Are Wizards Blog
Continue reading “A MobX introduction and case study”