Book Image

Learning ClojureScript

By : W. David Jarvis, Allen Rohner
Book Image

Learning ClojureScript

By: W. David Jarvis, Allen Rohner

Overview of this book

Clojure is an expressive language that makes it possible to easily tackle complex software development challenges. Its bias toward interactive development has made it a powerful tool, enabling high developer productivity. In this book, you will first learn how to construct an interactive development experience for ClojureScript.. You will be guided through ClojureScript language concepts, looking at the basics first, then being introduced to advanced concepts such as functional programming or macro writing. After that, we elaborate on the subject of single page web applications, showcasing how to build a simple one, then covering different possible enhancements. We move on to study more advanced ClojureScript concepts, where you will be shown how to address some complex algorithmic cases. Finally, you'll learn about optional type-checking for your programs, how you can write portable code, test it, and put the advanced compilation mode of the Google Closure Compiler to good use.
Table of Contents (15 chapters)
Learning ClojureScript
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
Preface

Understanding React


React is a library developed by Facebook, designed to efficiently render dynamic content on a page using a virtual DOM. React lets us pretend that the entire page is redrawn any time our application's state changes. As a page author, we write functions that take data and return DOM elements. React renders the DOM elements on the page. Importantly, when the data changes, React efficiently diffs the page and re-renders only the parts that have changed. Diffing is essential because re-rendering the entire page is prohibitively expensive on even moderately complex pages. React is an improvement over previous attempts at solving the problem because there's no need to specify data bindings or watchers. We just describe how to render the page and React handles the change detection for us.

The React terminology

React uses several terms that we'll define here.

  • Component: This is a single JS class implementing the React component interface. The most important function for a component...