ReasonML Quick Start Guide
Build fast and type-safe React applications that leverage the JavaScript and OCaml ecosystems
Raphael Rafatpanah
Bruno Joseph D'mello
BIRMINGHAM - MUMBAI
ReasonML Quick Start Guide
Copyright 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Richa Tripathi
Acquisition Editor: Noyonika Das
Content Development Editor: Mohammed Yusuf Imaratwale
Technical Editor: Sachin Sunilkumar
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Alishon Mendonsa
Production Coordinator: Nilesh Mohite
First published: February 2019
Production reference: 1280219
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78934-078-5
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the authors
Raphael Rafatpanah is a husband and father who wonders how he's going to pique his three-year-old daughter's interest in programming. With a background in business and math, he got started writing software to automate the data entry process at his family's business. Now, he's passionate about frontend development and the web platform. In his spare time, you'll find him searching for excellent sushi, photographing the world, and working on the elusive side project.
I'd like to thank my wife, Amy, for embarking on this journey with me, even when she was concerned that our daughter's first word would be "JSON", and for not slapping me when I responded with "it's still data."
To my daughter, Zoe, you're such a joy and I'm so proud of you. Your smile warms my heart.
Bruno Joseph D'mello is proactively working at Truckx as a full stack developer. He is a JavaScript enthusiast and loves working with open source communities. He possesses more than 6 years' experience in web development. Bruno follows kaizen and enjoys the freedom of architecting new things at work. He is socially active via coaching in web technologies and participating in other research projects and meetups.
When not engaged with technology, Bruno likes to spend quality time traveling with family and friends.
I would like to thank my family for their patience and support, especially my mom.
About the reviewer
Adam Coll is a full stack web developer and probably will be tomorrow. He has been at it for 10 years and loves the ever-changing and fast-paced landscape that is the web platform. Right now he's either fixing bad code he wrote last month, thinking about bad code he wrote yesterday or writing code that he doesn't realize is bad yet.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
ReactJS has changed the world of frontend development as we know it. Its creator, Jordan Walke, also created ReasonML and ReasonReact as the future of React. React's abstraction of the DOM allows for powerful programming paradigms that help solve JavaScript's maintainability problem, and in this book, we dive into exactly how Reason can help you build simpler, more maintainable React applications. This book is a hands-on guide to building React applications with ReasonML.
Who this book is for
The target audience of this book is JavaScript developers who are familiar with ReactJS. No previous experience with statically typed languages is required.
What this book covers
, Introduction to ReasonML , discusses the current state of web development and why we would consider ReasonML for frontend development (and more).
, Setting Up a Development Environment , gets us up and running.
, Creating ReasonReact Components , demonstrates how to create React components with ReasonML and ReasonReact. Here, we begin building an app shell that we add to throughout the rest of the book.
, BuckleScript, Belt, and Interoperability , gives us a well-rounded understanding of Reason's ecosystem and standard library.
, Effective ML , dives into some more advanced features of Reason's type system using business examples.
, CSS-in-JS (in Reason) , shows how CSS-in-JS works in Reason and how the type system can help.
, JSON in Reason , demonstrates how to convert JSON into data structures in Reason and illustrates how GraphQL can help.
Next page