Learn While You Poop! π©
π No pressure learning at 2 minutes per day.
Start with the basics, become a React 16.3 master
How frustrated do you get when youβre learning some tech and every resource you find is just wasting your time?
Either youβre reading random blogs that make no sense. Or youβre paying through the nose for expensive books and courses that youβll never finish anyway.
π² you give up piecing together random blogs
π you buy a book
πΈ get the video course upgrade too
π you start reading
π learn some basics
β you build some stuff
πΌ you get busy
π life gets in your way
π½ and you forget all about your course
β 6 weeks fly by
π you get stuck
π² you search random blogs for a solution
Twitter - Swizec Teller
Website - Learn While You Poop
Really loved the intro for the site!!!
π Old JavaScript
// Togglable paragraph in old JavaScript
<div>
<button id="showhide">Show paragraph</button>
<p id="toggleMe">This is the paragraph that is only displayed on request.</p>
</div>
<script>
function changeDisplayState(id) {
var d = document.getElementById('showhide'),
e = document.getElementById(id);
if (e.style.display === 'none' || e.style.display === '') {
e.style.display = 'block';
d.innerHTML = 'Hide paragraph';
} else {
e.style.display = 'none';
d.innerHTML = 'Show paragraph';
}
}
document.getElementById('showhide').addEventListener('click', function (e) {
e.preventDefault();
changeDisplayState('toggleMe');
});
</script>
π JQuery
// Togglable paragraph in jQuery
<div>
<button id="showhide">Show paragraph</button>
<p id="toggleMe">This is the paragraph that is only displayed on request.</p>
</div>
<script>
$("#showhide").on("click", function (e) {
e.preventDefault();
if ($("#toggleMe").is(":visible")) {
$(this).html("Show paragraph");
$("#toggleMe").hide();
}else{
$(this).html("Hide paragraph");
$("#toggleMe").show();
}
})
</script>
π React
// Togglable paragraph in React
class Toggled extends React.Component {
state = { show: true }
onToggle = () => this.setState({
show: !this.state.show
})
render() {
const { show } = this.state;
return (
<div>
<button onClick={this.onToggle}>
{show ? "Hide paragraph" : "Show paragraph}
</button>
{show && <p>This is the paragraph that is only displayed on request.</p>}
</div>
)
}
}
π You can think of components as LEGO blocks for your app.
Just keep in mind that components give you π