scrimba
Imba Router - Sticky routes
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Imba Router - Sticky routes
AboutCommentsNotes
Imba Router - Sticky routes
Expand for more info
components
Customers.imba
run
preview
console
import {rpc} from '../api'

import {Page} from './Page'

tag Customer
def load params
console.log "Customer.load",params:id
data = await rpc("/customers/{params:id}.json")

def render
<self>
<section>
<h2> data:name

export tag Customers < Page

def load
data = await rpc("/customers.json")

def render
<self>
<aside> <ul.entries>
for customer in data
<li.entry route-to=customer:id>
<span.name> customer:name

<Customer route=':id'>
Console
"Customer.load"
,
"5"
,
"Customer.load"
,
"4"
,
"Customer.load"
,
"6"
,
"Customer.load"
,
"7"
,
"Customer.load"
,
"8"
,
"Customer.load"
,
"6"
,
"Customer.load"
,
"5"
,
"Customer.load"
,
"4"
,
"Customer.load"
,
"5"
,
"Customer.load"
,
"6"
,
"Customer.load"
,
"7"
,
customers/7
-2:55