Build real-time responsive web apps using React and Bootstrap
Harmeet Singh . Mehul Bhatt
Book Details
Price
|
2.00 USD |
---|---|
Pages
| 249 p |
File Size
|
10,132 KB |
File Type
|
PDF format |
ISBN
| 978-1-78646-249-7 |
Copyright
| 2016 Packt Publishing |
Harmeet Singh is a senior UI developer working for CIGNEX Datamatics with varied
experience in UI. He hails from the holy city of Amritsar, India. His expertise includes
HTML5, JavaScript, jQuery, AngularJS, and Node.js. His interests include music, sports,
dancing, and adventure.
Harmeet has given various presentations and conducted many workshops on UI
development. On the academic front, Harmeet is a graduate in IT, and is a GNIIT diploma
holder from NIIT, specializing in software engineering.
He loves to spend time learning and discussing new technologies. He also writes technical
articles for his blog at liferayUI (http://liferayui.com ). Also, he is an author of the book
on Test-Driven JavaScript Development, Packt. He can be reached on Skype at
harmeetsingh090. You can also connect with him on LinkedIn at https://in.linkedin.com/in/harmeetsingh090.
I would like to thank my CIGNEX project team and my best friends, Nikhil Nair and
Nayan Jyoti Talukdar, whose support and encouragement led me to write this book and
kept me motivated throughout the journey of this book. Thank you so much co-author,
Mehul Bhatt, for the excellent support.
Mehul Bhatt has over 11 years of experience and serves as a user experience (UX) & user
interface (UI) practice manager at CIGNEX Datamatics. As a manager, he handles a wide
range of onshore and offshore teams. He hails from the princely state of Jamnagar, Gujarat,
India. His expertise includes HTML5, CSS3, JavaScript, jQuery, application development,
guiding and mentoring developers, and more, which helps clients to take their business to
the next level in the open market.
Mehul has also won many awards for his excellence. His interests include learning new
technologies, music, drama, sports, and exploring new places.
Mehul is Microsoft certified in HTML, CSS, and JavaScript. On the academic front, he holds
a post graduate diploma in multimedia, specialized in web development, which gives him
the skills to understand customer requirements and excel in the execution of the required
performance with the best code quality standards.
He can be reached on Skype at mehul_multimedia. You can also connect with him on
I'd like to thank Harmeet Singh for collaborating with me in developing such a handy book
for aspiring developers. I can't forget to thank my wife and my daughter for supporting me
at every stage of my life.
About the Reviewer
Sandeep Neema has a bachelor's degree in computer science. Presently, he is working as a
team lead in Systems Plus Solutions, Pune. In a varied career extending over seven years,
Sandeep has worked with TCS, CIGNEX Datamatics, and Azilen Technologies Pvt. Ltd. in
different technologies. He is an Oracle-certified Java developer and ISTQB Foundation
Level certified tester.
Preface
We all know that JavaScript applications are the future of web development, and there are
many different frameworks available to build isomorphic JavaScript web applications.
However, with the changing web development world, we all need to modernize ourselves
as developers to learn new frameworks and build new tools. It is important to analyze the
code methodology of the framework and adopt the same, rather than getting lost in the
framework market. ReactJS is an open source JavaScript library, similar to Bootstrap, used
for building user interfaces and is famously known as the V (view) in MVC. When we talk
about defining M and C, we can use other frameworks, such as Redux and Flux, to handle
the remote data.
Bootstrap is an open source frontend framework for developing responsive websites and
web applications. It includes HTML, CSS, and JavaScript code to build user interface
components. It’s a faster and easier way to develop a powerful mobile-first responsive
design. The Bootstrap library includes responsive 12-column grids and predefined classes
for easy layout options (fixed width and full width). Bootstrap has dozens of prestyled
reusable components and custom jQuery plugins, such as button, alerts, dropdowns,
modal, tooltip tab, pagination, carousal, badges, and icons.
This book starts with a detailed study of ReactJS and Bootstrap. The book further introduces
us on how to create small components of ReactJS with Twitter Bootstrap, React-Bootstrap,
and so on. It also gives us an understanding on JSX, Redux, and Node.js integration for
advanced concepts such as reducers, actions, store, live reload, and webpack. The goal is to
help readers to build responsive and scalable web applications with ReactJS and Bootstrap.
Table of Contents
Preface 1
Chapter 1: Getting Started with React and Bootstrap 7
ReactJS 8
Setting up the environment 10
Installing ReactJS and Bootstrap 11
Installing React 12
Bootstrap 13
Installing Bootstrap 14
Using React 15
Static form with React and Bootstrap 17
Summary 25
Chapter 2: Lets Build a Responsive Theme with React-Bootstrap and
React 26
Setting up 26
Scaffolding 28
Navigation 28
React-Bootstrap 31
Installing React-Bootstrap 32
Using React-Bootstrap 32
Benefits of React-Bootstrap 33
Bootstrap grid system 38
Helper classes 42
Floats 42
Center elements 43
Show and hide 43
React components 43
React.createElement() 44
Summary 48
Chapter 3: ReactJS-JSX 50
What is JSX in React 50
Advantages of using JSX in React 51
How to make your code neat and clean 51
Acquaintance or understanding 52
Semantics/structured syntax 52
The composite component 53
Namespace components 54
JSXTransformer 60
Attribute expressions 61
Boolean attributes 61
JavaScript expressions 62
Styles 62
Events 62
Attributes 63
Spread attributes 63
Example of a dynamic form with JSX 64
Summary 71
Chapter 4: DOM Interaction with ReactJS 72
Props and state 72
Form components 73
Props in form components 74
Controlled component 75
Uncontrolled component 76
Getting the form values on submit 77
Ref attribute 77
Bootstrap helper classes 89
Caret 89
Clearfix 90
Summary 90
Chapter 5: jQuery Bootstrap Component with React 91
Alerts 92
Usage 92
Bootstrap alert component in React 92
Component lifecycle methods 94
Component integration 95
Bootstrap modal 100
Summary 110
Chapter 6: Redux Architecture 111
What is Redux? 111
Single store approach 115
Read-only state 115
Reducer functions to change the state 116
Architecture of Redux 116
Redux's architectural benefits 118
Redux setup 118
Installing Node.js 119
Setting up the application 119
Development tool setup 120
Redux application setup 122
Actions 122
Reducers 123
Store 124
Components 125
Summary 131
Chapter 7: Routing with React 133
Advantages of React router 133
Installing router 135
Application setup 135
Creating routes 136
Page layout 138
Nested routes 141
React router 144
NotFoundRoute 149
Browser history 150
Query string parameters 151
Customizing your history further 153
Summary 154
Chapter 8: ReactJS API 155
React Top-Level API 155
React API component 155
Mount/Unmount components 156
Object-oriented programming 156
React integration with other APIs 159
React integration with the Facebook API 159
Installing Node 159
Setting up the application 160
Summary 179
Chapter 9: React with Node.js 180
Installing Node and npm 181
React application setup 183
Installing modules 184
Responsive Bootstrap application with React and Node 190
Bootstrap table 203
Bootstrap responsive tables 204
React developer tools 205
Installation 205
How to use 206
Summary 209
Chapter 10: Best Practices 210
Handling data in React 211
Using Flux 211
Using Redux 212
Redux is equal to Flux, really? 212
Single-store approach 213
Read-only state 213
Immutable React state 214
Observables and reactive solutions 215
React routing 215
How React will help to split your code in lazy loading 216
JSX components 217
How easy is it to visualize? 217
Acquaintance or understanding 218
Semantics/structured syntax 218
Using classes 219
Using PropType 219
Benefits of higher-order components 219
Redux architectural benefits 220
Customizing Bootstrap for your app 220
Bootstrap content – typography 221
Bootstrap component – navbar 223
Bootstrap component – forms 223
Bootstrap component – button 225
Bootstrap themes 226
Bootstrap responsive grid system 226
Interesting information about ReactJS and Bootstrap projects 227
Helpful React projects 228
Things to remember 231
Summary 231
Index 234
Who this book is for
If you have an intermediate knowledge of HTML, CSS, and JavaScript and want to learn
how and why ReactJS and Bootstrap is the first approach for developers to create fast,
responsive, and scalable user interface of your application, then this book is for you. If your
Model, View, Controller (MVC) concept is clear, then it’s added an advantage to
understand the architecture of React.