React and PureScript: Highlights from a frontend tech-sharing session

January 14, 2015

Read time 2 min

A few weeks ago, we held one of our internal frontend development tech-sharing session. The idea of these sessions is to present different libraries and projects that we are currently excited about and enjoy working with. For this session, we had two presentations on the React library and one regarding the PureScript language. Here are the highlights of each presentation.

I talked about a JavaScript library I’ve been very excited about for some time now. The library in question is called React, created and open sourced by Facebook. React allows you to easily build UIs with data that changes over time. The primary reason why I find it enjoyable to work with React is that it allows you to define your UI declaratively without the need to manually mutate the DOM at any given time. The library solves this problem by re-rendering the UI on every state change, and doing a diff with the previously rendered state, and internally mutating the DOM with only the changed parts. The great thing about React is that it doesn’t set restrictions on the rest of your stack, so you can easily use it with your other favorite libraries. The examples I presented used Bacon.js for updating the application state as well as propagating the changes back to React.

Anton Rissanen and Lauri Lehmijoki also discussed React, but more from a server point of view. Their focus was more on how you can create isomorphic web applications using React – in other words, an application that can run both client-side and server-side. One of the great features with React is that it does not rely on the DOM, so it can render your UI components in Node.js and serialize them into HTML that can be served to the client. The server-rendered application HTML can be re-initialized by React once the JavaScript has finished loading, transforming it into a single-page application. However, as the landing page is fully rendered on the server the first render can occur as soon as the CSS and HTML have been loaded by the client. This is especially important in mobile, where the first render of your application may take significantly longer if it depends on your JavaScript to be loaded before it can render your application.

Antti Holvikari shared his experiences with an interesting new language called PureScript. PureScript is a strongly typed language that compiles into JavaScript. It tries to provide a better functional programming language for JavaScript, while keeping the JavaScript semantics. Unlike Haskell, PureScript is strictly evaluated which allows it to be exported to be used with your other normal JavaScript. While it is just over a year old language, it has a fairly large range of libraries and components available for it.

What frontend technologies are you currently excited about? Any new technologies or browser features you are looking forward to from next year? Share your thoughts in the comments below.

Never miss a post