Introduction Into ReactJS (1)
Introduction Into ReactJS (1)
Introduction to ReactJS
Session 09
Learning Objectives
At the end of this meeting is expected that
students will be able to:
– Describe user interface component and the
main features of HTML 5
– Construct mobile web application based on
HTML 5
Contents
• What is ReactJS ?
• ReactJS Features
• Introducing JSX
• Making an Interactive Component
• Conditional Render
What is React JS ?
• B y c a l l i n g t h i s . s e t S tat e f ro m a n o n C l i c k h a n d l e r i n t h e
Square’s render method, we tell React to re-render that Square
w h e n eve r i t s < b u tto n > i s c l i c ke d . A f te r t h e u p d ate , t h e
Square’s this.state.value will be 'X', so we’ll see the X on the game
board. If you click on any Square, an X should show up.
Conditional Render
• In React, you can create different components that
include the required behavior.
• Then, you can render only parts of it, based on the state
of your application.
• Conditional rendering in React works the same way as
conditional operators in Javascript.
• Use JavaScript operators such as if or conditional
operators to create an element representation of the
current state, and React will update the UI according to
that state.
• Take a look at this two components :
• We’re going to create a greeting component that displays
one of the two components above based on whether the
user in logged in: