Skip to content

Latest commit

 

History

History

lesson-1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

jQuery vs React

Comparison of 2 approaches to web-app development (over-simplified):

  • "traditional" web app development using selectors, imperative style, plain-text ES5
  • "modern" declarative approach, separation of concerns using MV* (Model-View-Controller/Presenter/...) abstraction, compiled ES6+

jQuery, other Ajax libraries and modern Web API

Exercise #1:

  • download and open jquery/v1.html
  • edit to remove jQuery dependency, targeting IE11+ (assuming last 2 and "extended support" versions of other browsers)

MV* frameworks

For larger, more complicated dynamic applications, vanilla ES6 might be not enough.

Comparison of simple-but-practical implementation of the same TODO app in various MV* frameworks, libraries and vanilla JS: http://todomvc.com/

React

Exercise #2:

  • git clone https://github.com/msd-code-academy/lessons.git
  • cd lessons/lesson-1/react/v1
  • npm i
  • npm start
  • update the component to render static content similar to original jquery app
    • html title, main header, static button, static text
  • use life-cycle methods to add dynamic features

Exercise #3 (bonus):

  • add 3rd button to any of the solutions
  • change color of the text after pressing 'Blue' button to be more readable
  • add rounded corners for .output1 element after pressing 'Red' button (border-radius CSS property)

Conclusion

MV* frameworks and React-family in particular focus on maintainability:

  • easy to read and understand
  • easy to debug, e.g. inspect element in browser and find corresponding code

Homework

  • bonus exercise (if we didn't have enough time)
  • http://todomvc.com/ - review a few examples, e.g. for React