Intermediate
Load the report only when asked
REPORT_URL is a module whose default export makeReport(sales) returns a sentence. It prints report module loaded when it runs.
When Show report is clicked, load the module with dynamic import() and put makeReport(sales) into #report. The module must not load before the first click, and must load only once however many times the button is clicked.
What Check tests
- The module isn't loaded before the click
- After a click, the report says
Total sales: 600 - A second click doesn't load the module again
- Uses dynamic
import() - No errors in the console
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.