SlideShare a Scribd company logo
"How to... React" by Luca Perna
"How to... React" by Luca Perna
•
•
•
•
•
"How to... React" by Luca Perna
•
•
"How to... React" by Luca Perna
import React from 'react';
import ReactDOM from 'react-dom';
class Hello extends React.Component {
render() {
return React.createElement('div', null, 'Hello world!');
}
}
ReactDOM.render(
React.createElement(Hello),
document.getElementById('root')
);
React.createElement('a', { href: 'https://goo.gl/zRPems' }, "lorem ipsum");
<a href={'https://goo.gl/zRPems'}>{'lorem ipsum'}</a>
import React from 'react';
import ReactDOM from 'react-dom';
class Hello extends React.Component {
render() {
return <div>{'Hello world!'}</div>;
}
}
ReactDOM.render(
<Hello />,
document.getElementById('root')
);
•
•
•
•
class Hello extends React.Component {
render() {
const whatToGreeting = this.props.whatToGreeting;
return <div>{`Hello ${whatToGreeting}!`}</div>;
}
}
ReactDOM.render(
<Hello whatToGreeting="world" />,
document.getElementById('root')
);
"How to... React" by Luca Perna
import PropTypes from 'prop-types';
class Hello extends React.Component {
static propTypes = {
whatToGreeting: PropTypes.string.isRequired,
}
render() {
const whatToGreeting = this.props.whatToGreeting;
return <div>{`Hello ${whatToGreeting}!`}</div>;
}
}
import PropTypes from 'prop-types';
class Hello extends React.Component {
render() {
const whatToGreeting = this.props.whatToGreeting;
return <div>{`Hello ${whatToGreeting}!`}</div>;
}
}
Hello.propTypes = {
whatToGreeting: PropTypes.string.isRequired,
};
•
•
•
class MyButton extends React.Component {
constructor() {
super();
this.state = {
label: 'Click me',
};
}
render() {
return <button>{this.state.label}</button>;
}
}
class MyButton extends React.Component {
constructor() {
super();
this.state = {
label: 'Click me',
};
}
handleClick = () => {
this.setState({
label: 'Clicked',
});
}
render() {
return <button onClick={this.handleClick}>{this.state.label}</button>;
}
}
"How to... React" by Luca Perna
const buttonStyle = {
borderRadius: 5,
padding: '15px',
backgroundColor: 'yellow',
};
class MyButton extends React.Component {
render() {
return <button style={buttonStyle}>{'I am a fantastic button'}</button>;
}
}
import './buttonStyle.css';
class MyButton extends React.Component {
render() {
return (
<button className={'yellow-button'}>
{'I am a fantastic button with a fantastic class'}
</button>
);
}
}
import styled from 'styled-component';
const StyledButton = styled.button`
border-radius: 5px;
padding: 15px;
background-color: yellow;
`;
class MyButton extends React.Component {
render() {
return <StyledButton>{'I am a styled component now!!'}</StyledButton>;
}
}
"How to... React" by Luca Perna
"How to... React" by Luca Perna

More Related Content

PDF
Introduction to ReactJS
PPTX
Getting started with ReactJS
PDF
Advanced redux
PDF
Introduction to ReactJS and Redux
PDF
Quick start with React | DreamLab Academy #2
PDF
Reduxing like a pro
PDF
Testing AngularJS
PPTX
ReactJS for Beginners
Introduction to ReactJS
Getting started with ReactJS
Advanced redux
Introduction to ReactJS and Redux
Quick start with React | DreamLab Academy #2
Reduxing like a pro
Testing AngularJS
ReactJS for Beginners

What's hot (20)

PDF
Redux Universal
PDF
Neoito — React 101
PDF
React on es6+
PDF
Using redux
PDF
Switch to React.js from AngularJS developer
PPT
Testing in AngularJS
PDF
React redux
PDF
AngularJS Unit Testing w/Karma and Jasmine
PPTX
Better web apps with React and Redux
PDF
AngularJS Unit Test
PDF
Intro to Unit Testing in AngularJS
PDF
Intro to Redux | DreamLab Academy #3
PPTX
Academy PRO: React JS. Redux & Tooling
PDF
Pragmatic React Workshop
PDF
Test-Driven Development of AngularJS Applications
PDF
Intro to testing Javascript with jasmine
PDF
Creating a WYSIWYG Editor with React
PDF
Designing applications with Redux
PDF
Dive into React Performance
PDF
React Lifecycle and Reconciliation
Redux Universal
Neoito — React 101
React on es6+
Using redux
Switch to React.js from AngularJS developer
Testing in AngularJS
React redux
AngularJS Unit Testing w/Karma and Jasmine
Better web apps with React and Redux
AngularJS Unit Test
Intro to Unit Testing in AngularJS
Intro to Redux | DreamLab Academy #3
Academy PRO: React JS. Redux & Tooling
Pragmatic React Workshop
Test-Driven Development of AngularJS Applications
Intro to testing Javascript with jasmine
Creating a WYSIWYG Editor with React
Designing applications with Redux
Dive into React Performance
React Lifecycle and Reconciliation
Ad

Similar to "How to... React" by Luca Perna (20)

PDF
Universal Javascript in React
PPTX
React JS Lecture 10.pptx Our clg lecture
PDF
Why react matters
PDF
Basic Tutorial of React for Programmers
PDF
Redux vs Alt
PPTX
Getting Started with React v16
PPTX
Ba Node.js Meetup React Native Presentation
PPTX
React & Redux for noobs
PDF
React.js or why DOM finally makes sense
PPT
PDF
TDC2016SP - Trilha Frameworks JavaScript
PDF
React for Beginners
PDF
React lecture
PPTX
ReactJs presentation
PPTX
React outbox
PDF
React Facebook JavaScript Library
PDF
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4
PPTX
20171108 PDN HOL React Basics
PDF
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
PDF
ReactJS for Programmers
Universal Javascript in React
React JS Lecture 10.pptx Our clg lecture
Why react matters
Basic Tutorial of React for Programmers
Redux vs Alt
Getting Started with React v16
Ba Node.js Meetup React Native Presentation
React & Redux for noobs
React.js or why DOM finally makes sense
TDC2016SP - Trilha Frameworks JavaScript
React for Beginners
React lecture
ReactJs presentation
React outbox
React Facebook JavaScript Library
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4
20171108 PDN HOL React Basics
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
ReactJS for Programmers
Ad

More from ThinkOpen (20)

PDF
Discover Facilitation: gestire le riunioni in modo efficace
PDF
Infrastructure as a code: a cloud approach
PDF
Smart Signage: la nuova digital experience
PDF
I Graph Database: analisi del comportamento degli utenti
PDF
2019: Odissea nell'e-commerce
PDF
Guida galattica a Javascript
PDF
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
PDF
Amazon Alexa vs Google Home. Quale scegliere? Funzionalità e usi
PDF
Amazon Web Services - Le potenzialità di AWS e il mondo di Amazon Alexa by Ni...
PPTX
Polymer 3.0 by Michele Gallotti
PDF
"Java 8, Lambda e la programmazione funzionale" by Theodor Dumitrescu
PDF
"Odoo: l'open source che fa tremare SAP" by Davide Davin e Nicola Napolitano
PDF
"Configuration Manager: il ruolo nel ciclo di vita del software" by Omar Rossini
PDF
"Google Home: how to make Google do it" by Theodor Dumitrescu e Gianfranco Bo...
PDF
"ThinkOpen Agile Days - #Day3" by Donato Andrisani e Giuseppe Trotta
PDF
"Reactive programming" by Theodor Dumitrescu & Gianfranco Bottiglieri
PDF
"GDPR: cos'è e come funziona" by Francesco Puglisi
PDF
"ThinkOpen Agile Days - #Day2" by Donato Andrisani e Giuseppe Trotta
PDF
"ThinkOpen Agile Days - #Day" by Giuseppe Trotta
PDF
"React Native" by Vanessa Leo e Roberto Brogi
Discover Facilitation: gestire le riunioni in modo efficace
Infrastructure as a code: a cloud approach
Smart Signage: la nuova digital experience
I Graph Database: analisi del comportamento degli utenti
2019: Odissea nell'e-commerce
Guida galattica a Javascript
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Amazon Alexa vs Google Home. Quale scegliere? Funzionalità e usi
Amazon Web Services - Le potenzialità di AWS e il mondo di Amazon Alexa by Ni...
Polymer 3.0 by Michele Gallotti
"Java 8, Lambda e la programmazione funzionale" by Theodor Dumitrescu
"Odoo: l'open source che fa tremare SAP" by Davide Davin e Nicola Napolitano
"Configuration Manager: il ruolo nel ciclo di vita del software" by Omar Rossini
"Google Home: how to make Google do it" by Theodor Dumitrescu e Gianfranco Bo...
"ThinkOpen Agile Days - #Day3" by Donato Andrisani e Giuseppe Trotta
"Reactive programming" by Theodor Dumitrescu & Gianfranco Bottiglieri
"GDPR: cos'è e come funziona" by Francesco Puglisi
"ThinkOpen Agile Days - #Day2" by Donato Andrisani e Giuseppe Trotta
"ThinkOpen Agile Days - #Day" by Giuseppe Trotta
"React Native" by Vanessa Leo e Roberto Brogi

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation theory and applications.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
sap open course for s4hana steps from ECC to s4
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

"How to... React" by Luca Perna

  • 8. import React from 'react'; import ReactDOM from 'react-dom'; class Hello extends React.Component { render() { return React.createElement('div', null, 'Hello world!'); } } ReactDOM.render( React.createElement(Hello), document.getElementById('root') );
  • 9. React.createElement('a', { href: 'https://goo.gl/zRPems' }, "lorem ipsum"); <a href={'https://goo.gl/zRPems'}>{'lorem ipsum'}</a>
  • 10. import React from 'react'; import ReactDOM from 'react-dom'; class Hello extends React.Component { render() { return <div>{'Hello world!'}</div>; } } ReactDOM.render( <Hello />, document.getElementById('root') );
  • 12. class Hello extends React.Component { render() { const whatToGreeting = this.props.whatToGreeting; return <div>{`Hello ${whatToGreeting}!`}</div>; } } ReactDOM.render( <Hello whatToGreeting="world" />, document.getElementById('root') );
  • 14. import PropTypes from 'prop-types'; class Hello extends React.Component { static propTypes = { whatToGreeting: PropTypes.string.isRequired, } render() { const whatToGreeting = this.props.whatToGreeting; return <div>{`Hello ${whatToGreeting}!`}</div>; } }
  • 15. import PropTypes from 'prop-types'; class Hello extends React.Component { render() { const whatToGreeting = this.props.whatToGreeting; return <div>{`Hello ${whatToGreeting}!`}</div>; } } Hello.propTypes = { whatToGreeting: PropTypes.string.isRequired, };
  • 17. class MyButton extends React.Component { constructor() { super(); this.state = { label: 'Click me', }; } render() { return <button>{this.state.label}</button>; } }
  • 18. class MyButton extends React.Component { constructor() { super(); this.state = { label: 'Click me', }; } handleClick = () => { this.setState({ label: 'Clicked', }); } render() { return <button onClick={this.handleClick}>{this.state.label}</button>; } }
  • 20. const buttonStyle = { borderRadius: 5, padding: '15px', backgroundColor: 'yellow', }; class MyButton extends React.Component { render() { return <button style={buttonStyle}>{'I am a fantastic button'}</button>; } }
  • 21. import './buttonStyle.css'; class MyButton extends React.Component { render() { return ( <button className={'yellow-button'}> {'I am a fantastic button with a fantastic class'} </button> ); } }
  • 22. import styled from 'styled-component'; const StyledButton = styled.button` border-radius: 5px; padding: 15px; background-color: yellow; `; class MyButton extends React.Component { render() { return <StyledButton>{'I am a styled component now!!'}</StyledButton>; } }