Vignesh M
Full Stack Web/Mobile Engineer | Python ❤ JavaScript Developer | Django ❤ React Expert, Mentor, Trainer and Hacker
with Vignesh M
setState
components
Portals
higher order
rebase
render
prop stars
whereAreMyProps
whyDidYouUpdate
V = F(D)
jsx
@vigzmv
A JavaScript library for building user interfaces
JQuery
React
Write code to manipulate DOM
Write code to manipulate DATA
$myBtn = $("<button>");
$myBtn.addClass("button");
$myBtn.html("...");
if (toggled) {
$myBtn.addClass("toggled");
}
$myBtn.appendTo(...);
// later, when `toggled` changes.
$myBtn.toggleClass("toggled", toggled);
render() {
const classes = state.toggled ? "myButton toggled": "toggled";
return <button className={classes}>
....
</button>;
}
JQuery
React
Imperative: How to do?
Declarative: What to do?
JQuery is okay, but not good for modern JavaScript Applications.
class App extends React.Component {
render() {
return (
<div>I am a Component</div>
)
}
}
const Add = (x,y) => x + y;
Add(2,3); // 5
const AddTwo = (x) => Add(x,2);
AddTwo(3); // 5
const EnhancedComponent =
higherOrderComponent(WrappedComponent);
@vigzmv
By Vignesh M