Create a modern web application with React
Difficulty: Junior ● Progress: 0 / 0 modules completed
Using Calculated Variables

So far, we've learned how to create reactive states with useState, or how to use props to pass data to a component.
But sometimes you need to derive a value from what you already have, for example:
- Calculating a total from an array of prices
- Displaying different text depending on usage
- Etc...
These intermediate variables are computed (or derived) variables: they are not directly stored in the state, but are dynamically generated from other values.
Let's imagine an application where we know a first name and an age, and we want to display a complete sentence:
You need to purchase this course to read this module!
Or !