let and const.
This is the ES6 way of assigning variables, it replaces "var".
"let" is for variables that are gonna be reassigned in the future.
"const" is for variables that are not gonna change, you define them and you use them, but they have a "constant" value.
This is the ES6 way of assigning variables, it replaces "var".
"let" is for variables that are gonna be reassigned in the future.
"const" is for variables that are not gonna change, you define them and you use them, but they have a "constant" value.
Template literals.
This is an easy way to concatenate strings. You use the backtick ` for them.
Instead of having to do:
"Hello, my name is " + name + ", nice to meet you!"
You do:
`Hello, my name is ${name}, nice to meet you!`
A lot easier, isn't it?
This is an easy way to concatenate strings. You use the backtick ` for them.
Instead of having to do:
"Hello, my name is " + name + ", nice to meet you!"
You do:
`Hello, my name is ${name}, nice to meet you!`
A lot easier, isn't it?
Conditional rendering.
What if we don't want to show anything if the condition is false?
We can do
condition ? 'something' : null
Or we can also do
condition && 'something'
This will produce the same result but its much cleaner.
What if we don't want to show anything if the condition is false?
We can do
condition ? 'something' : null
Or we can also do
condition && 'something'
This will produce the same result but its much cleaner.
These are the fundamentals you need to know before learning React.
Don't try to learn everything in JavaScript before trying it.
And if you feel ready to build your first app, I have a tutorial ready just for you!
Don't try to learn everything in JavaScript before trying it.
And if you feel ready to build your first app, I have a tutorial ready just for you!
Loading suggestions...