Book Image

Clojure Reactive Programming

Book Image

Clojure Reactive Programming

Overview of this book

Table of Contents (19 chapters)
Clojure Reactive Programming
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Bibliography
Index

ClojureScript and Om


Why have I spent six pages talking about JavaScript and React in a Clojure book? I promise I'm not trying to waste your precious time; we simply needed some context to understand what's to come.

Om is a ClojureScript interface to React.js developed by the prolific and amazing individual David Nolen, from Cognitect. Yes, he has also developed core.logic, core.match, and the ClojureScript compiler. That's how prolific. But I digress.

When Facebook released React, David immediately saw the potential and, more importantly, how to take advantage of the assumptions we are able to make when programming in Clojure, the most important of which is that data structures don't change.

React provides several component life-cycle functions that allow developers to control various properties and behaviors. One in particular, shouldComponentUpdate, is used to decide whether a component needs to be re-rendered.

React has a big challenge here. JavaScript is inherently mutable, so it is extremely...