<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lisabaut</title>
<link href="style.css" rel="stylesheet">
<script src="app.js"></script>
</head>
<body>
<div id="wrapper">
<header>
<h1>Lisabaut</h1>
</header>
</div>
</body>
</html>
body {
border-top: solid 0.4em #6fc5c5;
}
header {
margin: 0 auto;
}
header h1 {
font-size: 5em;
text-transform: uppercase;
letter-spacing: 6px;
color: #6fc5c5;
}
index.html
style.css
index.html
style.css
app.js
Server
Browser
$('h1').click(function() {
alert( "H1 was clicked!" );
});
app.js
index.html
style.css
app.js
Server
Client (Browser)
Anfrage
HTML
CSS
JavaScript
Antwort
index.html
style.css
app.js
Server
Client (Browser)
Anfrage
HTML
CSS
JavaScript
Antwort
WordPress,
Drupal, Typo3...
Mit PHP das HTML auf
Server generieren
PHP
http://
GET
index.html
style.css
app.js
Request URL
Rendering
Client
Server
index.html
style.css
app.js
- Server schliesst Verbindung nach der Antwort
- neuer Request notwendig, um andere Daten vom Server anzuzeigen
- JavaScript für mehr Interaktivität auf Oberfläche einsetzen
- JavaScript Bibliothek (library)
- HTML Elemente selektieren
- HTML Elemente manipulieren
=> verändern, austauschen, animieren, bewegen etc....
- Daten nachladen und Daten auf Oberfläche anzeigen (ajax)
- einfachere Syntax als pures JavaScript
- bügelt Browserunterschiede beim JavaScript Rendern aus
- viele OpenSource PlugIns
- Wikipedia: jede zweite Website benutzt jQuery
- Document Object Model (DOM)
- Schnittstelle für HTML-Dokumente
=> JavaScript/jQuery benutzt DOM, um HTML-Elemente zu selektieren
Klick !
jQuery reagiert
jQuery Style
Event Handler
Change the DOM
Change the DOM
Change the DOM
HTML
CSS
JavaScript/jQuery
- Image-Slider
- Accordions
- Tabs
- Animations
- Eingabe-Formen
....
- Chats
- News-Feed
- neue Follower
- Freundschaftanfrage
- Aktivität der Freunde
....
HTML
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Fire jQuery!
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
Event Handler
Change the DOM
einzelne Komponenten der Nutzeroberfläche (UI)
jede Komponente hat einen
eigenen Zustand (state)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lisabaut</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<header>
<h1>Lisabaut</h1>
</header>
</div>
<script src="app.js"></script>
</body>
</html>
body {
border-top: solid 0.4em #6fc5c5;
}
header {
margin: 0 auto;
}
header h1 {
font-size: 5em;
text-transform: uppercase;
letter-spacing: 6px;
color: #6fc5c5;
}
index.html
style.css
index.html
style.css
app.js
Server
Browser
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Header from './Header';
class App extends Component {
render() {
return (
<Header />
);
}
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
app.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lisabaut</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script src="app.js"></script>
</body>
</html>
Single-Page-Application
http://lisabaut.de/react
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.
- Facebook React Docs -
- Components identifizieren
- welche Component kontrolliert welchen Oberflächenzustand?
<Portfolio />
Filter
Filter Button
event
Filter Button
Filter Button
Portfolio List
Portfolio Item
Portfolio Item
Portfolio Item
props
props
props
event
props
Portfolio
Items
Filter By = Drucksachen
User Click on Button
Re-render Portfolio
Filters
Portfolio Component
class FilterButton extends React.Component {
render() {
return (
<button>Drucksachen</button>
)
}
}
http://chibicode.com/react-js-introduction-for-people-who-know-just-enough-jquery-to-get-by/
- https://facebook.github.io/react/docs/
- https://facebook.github.io/react/docs/thinking-in-react.html
- https://medium.freecodecamp.com/the-5-things-you-need-to-know-to-understand-react-a1dbd5d114a3
- https://css-tricks.com/projects-need-react/
- http://chibicode.com/react-js-introduction-for-people-who-know-just-enough-jquery-to-get-by/
- https://jquery.com/
jQuery - Wo ist der Text?
https://codepen.io/lisabaut/pen/eWGmvr
React - Wo ist der Text?
https://codepen.io/lisabaut/pen/ZKveVa
Facebook React Docs:
https://facebook.github.io/react/docs/hello-world.html
React: Five Fingers of Death:
https://medium.freecodecamp.com/the-5-things-you-need-to-know-to-understand-react-a1dbd5d114a3
CSS Tricks: Productive in react within one week
https://css-tricks.com/productive-in-react/
React Introduction for people who know jQuery:
http://chibicode.com/react-js-introduction-for-people-who-know-just-enough-jquery-to-get-by/
React How To:
https://github.com/petehunt/react-howto
React for Beginners:
https://reactforbeginners.com/
Learn Es6:
https://es6.io/
React Components mit ES6
http://babeljs.io/blog/2015/06/07/react-on-es6-plus
React written in jQuery
http://hackflow.com/blog/2015/03/08/boiling-react-down-to-few-lines-in-jquery/
Redux React List (super):
https://github.com/markerikson/react-redux-links
Getting Started with Redux
https://egghead.io/courses/getting-started-with-redux
Learn Redux mit WesBos
https://learnredux.com/