CSE 134B Lecture Notes - Lecture 8: Dom Events, React (Javascript Library), Web Application
Document Summary
Used for building user interfaces (the look of the page) Flexible - focuses on the view of the ui, doesn"t care where data comes from. Modular - easy to scale (only part of your web app using react) Rendering a model to the dom events. React focuses on the view & events (i. e. the view of the mvc) Take updates to the browser (dom) ( repaints the entire dom) Generates html in js (not enhancing like angular) Virtual dom (render html tree virtually and react will update the changes only ) Use a class: class hello extends react. component { classname render() { return(); Buttons class button extends react. component { handleclick = () => {}; render() { Handle state class button extends react. component { state = { counter: 0}; handleclick = () => { Return { counter: prevstate. counter + 1 } render() { this - component instance we are sending to the dom this. setstate - prevents race conditions .