SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
Uvod u React
03/11/2016
Goran Gajic
twitter.com/golenull
github.com/gorangajic
Deklarativan
Opišete kako vaš interfejs izgleda i u svakom
trenutku tako će i izgledati
Bazira se na Komponentama
- Kockice za pravljenje vase aplikacije
- Lako se sklapaju
- Jednostavno se koriste
- Izmene su lakse, zato sto su promene
izolovane po komponentama
Dostupan
- Radi u vasoj postojećoj aplikaciji
- Radi na serveru
- Uz pomoć react-native pišete mobilne
aplikacije
JSX
- JSX je nadogradnja na JavaScript
- Sva moć JavaScripta, bez uvođenja novog jezika
- Nije neophodan, ali olakšava posao
- Ponaša se kao i HTML, JSX ima ime taga, attribute i
svoju decu.
JSX
class Hello extends React.Component {
render() {
return <h1> Hello World </h1>;
}
}
class Hello extends React.Component {
render() {
return React.createElement(
"h1", null, "Hello World"
);
}
}
rendering
class Message extends React.Component {
render() {
return (<div className="message">
<Avatar username={this.props.user} size="large" />
<ChatMessage>
{this.props.message}
</ChatMessage>
</div>);
}
}
state
class Hello extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false,
}
}
componentDidMount() {
this.setState({ open: true });
}
...
props
class Chat extends React.Component {
...
render() {
return (<div className="chat">
<MessagesList messages={this.state.messages} />
<ChatInput onChange={(message) => this.addMessage(message)} />
</div>);
}
....
}
Events
class ChatInput extends React.Component {
render() {
return (<div className="form-inline">
<input
value={this.state.message}
onChange={(e) => this.setState({ message: e.target.value })}
/>
<button onClick={() => this.saveMessage()}>
Send
</button>
</div>);
}
}
React DOM
Biblioteka koja je zadužena za prikaz vaših komponenti na stranici
ReactDOM.render(
<App />,
document.getElementById('root')
);
Alati
- Node.js
- npm
- Babel
- Webpack
Create react app
npm install -g create-react-app
create-react-app moja-aplikacija
cd moja-aplikacija/
npm start
Demo

Contenu connexe

Tendances

MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63Angel Alberici
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#Bohdan Pashkovskyi
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introductionejlp12
 
Integration Microservices
Integration MicroservicesIntegration Microservices
Integration MicroservicesKasun Indrasiri
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaEdureka!
 
Top 50 MuleSoft interview questions
Top 50 MuleSoft interview questionsTop 50 MuleSoft interview questions
Top 50 MuleSoft interview questionstechievarsity
 
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise WorkloadsAmazon Web Services
 
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous Automation
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous AutomationAccelerate Adoption of SAP S/4HANA with Intelligent, Continuous Automation
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous AutomationWorksoft
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
OOW09 Integration Architecture EBS R12
OOW09 Integration Architecture  EBS R12OOW09 Integration Architecture  EBS R12
OOW09 Integration Architecture EBS R12jucaab
 

Tendances (20)

Angular
AngularAngular
Angular
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
Node.js
Node.jsNode.js
Node.js
 
Selenium
SeleniumSelenium
Selenium
 
SAP Testing
SAP TestingSAP Testing
SAP Testing
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Mulesoft ppt
Mulesoft pptMulesoft ppt
Mulesoft ppt
 
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
 
Asynchronous programming in C#
Asynchronous programming in C#Asynchronous programming in C#
Asynchronous programming in C#
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Integration Microservices
Integration MicroservicesIntegration Microservices
Integration Microservices
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
 
oracle service bus
oracle service busoracle service bus
oracle service bus
 
Top 50 MuleSoft interview questions
Top 50 MuleSoft interview questionsTop 50 MuleSoft interview questions
Top 50 MuleSoft interview questions
 
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
(ARC305) How J&J Manages AWS At Scale For Enterprise Workloads
 
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous Automation
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous AutomationAccelerate Adoption of SAP S/4HANA with Intelligent, Continuous Automation
Accelerate Adoption of SAP S/4HANA with Intelligent, Continuous Automation
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
OOW09 Integration Architecture EBS R12
OOW09 Integration Architecture  EBS R12OOW09 Integration Architecture  EBS R12
OOW09 Integration Architecture EBS R12
 

Uvod u react

  • 1. Uvod u React 03/11/2016 Goran Gajic twitter.com/golenull github.com/gorangajic
  • 2. Deklarativan Opišete kako vaš interfejs izgleda i u svakom trenutku tako će i izgledati
  • 3. Bazira se na Komponentama - Kockice za pravljenje vase aplikacije - Lako se sklapaju - Jednostavno se koriste - Izmene su lakse, zato sto su promene izolovane po komponentama
  • 4. Dostupan - Radi u vasoj postojećoj aplikaciji - Radi na serveru - Uz pomoć react-native pišete mobilne aplikacije
  • 5. JSX - JSX je nadogradnja na JavaScript - Sva moć JavaScripta, bez uvođenja novog jezika - Nije neophodan, ali olakšava posao - Ponaša se kao i HTML, JSX ima ime taga, attribute i svoju decu.
  • 6. JSX class Hello extends React.Component { render() { return <h1> Hello World </h1>; } } class Hello extends React.Component { render() { return React.createElement( "h1", null, "Hello World" ); } }
  • 7. rendering class Message extends React.Component { render() { return (<div className="message"> <Avatar username={this.props.user} size="large" /> <ChatMessage> {this.props.message} </ChatMessage> </div>); } }
  • 8. state class Hello extends React.Component { constructor(props) { super(props); this.state = { open: false, } } componentDidMount() { this.setState({ open: true }); } ...
  • 9. props class Chat extends React.Component { ... render() { return (<div className="chat"> <MessagesList messages={this.state.messages} /> <ChatInput onChange={(message) => this.addMessage(message)} /> </div>); } .... }
  • 10. Events class ChatInput extends React.Component { render() { return (<div className="form-inline"> <input value={this.state.message} onChange={(e) => this.setState({ message: e.target.value })} /> <button onClick={() => this.saveMessage()}> Send </button> </div>); } }
  • 11. React DOM Biblioteka koja je zadužena za prikaz vaših komponenti na stranici ReactDOM.render( <App />, document.getElementById('root') );
  • 12. Alati - Node.js - npm - Babel - Webpack
  • 13. Create react app npm install -g create-react-app create-react-app moja-aplikacija cd moja-aplikacija/ npm start
  • 14. Demo