Hopp til hovedinnhold
  1. Postkontoret

    /

  2. Jørund Amsen​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌

Jørund Amsen​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌

2 innlegg

Subscription pattern with Compound components in React​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‍‌​‌​‍​​​​‌‌‌‍‌‍‌‍‌‍​‌​​‍‌‌‍‌​‌‍‌​​‍‌​‌​​‍‌​‌​​‍‌‌‍​‌​‌‍​‍‌‌‍​‌​​‌‌‍​‍‌‍​‌​‍‌​‍‌​​​​‍​​‍​‍‌​‌‍‌‍‌‍​​‌‍​​​‌​​‍‌‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‌​‌‍‍‌‌‌​‌‍​‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‍‌​‌​‍​​​​‌‌‌‍‌‍‌‍‌‍​‌​​‍‌‌‍‌​‌‍‌​​‍‌​‌​​‍‌​‌​​‍‌‌‍​‌​‌‍​‍‌‌‍​‌​​‌‌‍​‍‌‍​‌​‍‌​‍‌​​​​‍​​‍​‍‌​‌‍‌‍‌‍​​‌‍​​​‌​​‍‌‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‌​‌‍‍‌‌‌​‌‍​‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌

React​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‌​​‍​‌‍‌‌​‍​‌‍‌​‌‍‌​​​‌‍​‍​‍‌​‌‍​​​​‍​‌‍‌​​‍‌​‌​​‌​‌​​‌​‍‌‌‍​‌​​‍​​‌​‌​​‍‌​​‍‌‍​‍‌‍​‍​‌​‌‍‌‍​‌‍​​​​‍‌‍‌​​‌​​‌​‌​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‌​‌‍​‌‌‍‌​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‌​​‍​‌‍‌‌​‍​‌‍‌​‌‍‌​​​‌‍​‍​‍‌​‌‍​​​​‍​‌‍‌​​‍‌​‌​​‌​‌​​‌​‍‌‌‍​‌​​‍​​‌​‌​​‍‌​​‍‌‍​‍‌‍​‍​‌​‌‍‌‍​‌‍​​​​‍‌‍‌​​‌​​‌​‌​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‌​‌‍​‌‌‍‌​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌
Artikkel (7 min)
Fra Jørund Amsen​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌
20.12.2021

Compound component is a react design pattern popular in UI libraries such as Chakra, Reach, Semantic and Material. It allows us to write a declarative and flexible API for complex components that implicitly share a state. Today we'll look at an introduction and a slightly more complex example of the patthern​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‍‌​‌​‍​​​​‌‌‌‍‌‍‌‍‌‍​‌​​‍‌‌‍‌​‌‍‌​​‍‌​‌​​‍‌​‌​​‍‌‌‍​‌​‌‍​‍‌‌‍​‌​​‌‌‍​‍‌‍​‌​‍‌​‍‌​​​​‍​​‍​‍‌​‌‍‌‍‌‍​​‌‍​​​‌​​‍‌‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌​‌‍‌‌‌​‌‍​‌​‍‌‍‍‌‌​​‌‌​‌‍‍‌‌‍‌‍‍​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‍‌​‌​‍​​​​‌‌‌‍‌‍‌‍‌‍​‌​​‍‌‌‍‌​‌‍‌​​‍‌​‌​​‍‌​‌​​‍‌‌‍​‌​‌‍​‍‌‌‍​‌​​‌‌‍​‍‌‍​‌​‍‌​‍‌​​​​‍​​‍​‍‌​‌‍‌‍‌‍​​‌‍​​​‌​​‍‌‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌​‌‍‌‌‌​‌‍​‌​‍‌‍‍‌‌​​‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌

The ins and outs of Kotlin​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌‌‍​‌​‍​​‌‍​​​​​​‌‍‌‌‌‍​‌‌‍​‍​‍‌‌‍‌​​​​​‌‌‍‌​​‍‌​‌​​​‍​‌​‌‍​‍‌​‍​‌‍‌​‌‍‌‍‌‍​‌​‍‌​‌‍‌‍‌​‌‍​​​​‌‍‌​‌‍‌‌​‍​‌‍​‌​​​​‍‌​‌‍​‌‍​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‌​‌‍‍‌‌‌​‌‍​‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌‌‍​‌​‍​​‌‍​​​​​​‌‍‌‌‌‍​‌‌‍​‍​‍‌‌‍‌​​​​​‌‌‍‌​​‍‌​‌​​​‍​‌​‌‍​‍‌​‍​‌‍‌​‌‍‌‍‌‍​‌​‍‌​‌‍‌‍‌​‌‍​​​​‌‍‌​‌‍‌‌​‍​‌‍​‌​​​​‍‌​‌‍​‌‍​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‌​‌‍‍‌‌‌​‌‍​‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌

Kotlin​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​​​​​‌‍​​‌‌​​​​‌​​​‌‍​‍‌​‍‌​​​​​‍​‍‌​‍‌​‌​‌‍‌​​‌​​​‍‌​‍‌​​‍​‍​​‌‌​‍‌​​‌​​‍​‍​​‌‌​‌‌​‌‌‌‍‌​‌‍​‌​‍​​‌‍‌‍‌‌‌‍‌​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‌​‌‍​‌‌‍‌​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​​​​​‌‍​​‌‌​​​​‌​​​‌‍​‍‌​‍‌​​​​​‍​‍‌​‍‌​‌​‌‍‌​​‌​​​‍‌​‍‌​​‍​‍​​‌‌​‍‌​​‌​​‍​‍​​‌‌​‌‌​‌‌‌‍‌​‌‍​‌​‍​​‌‍‌‍‌‌‌‍‌​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‌​‌‍​‌‌‍‌​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌
Artikkel (13 min)
Fra Jørund Amsen​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌​‌‌‌‍‌‌​​‌‌‍‌​‌‍‌‌​‌​​‌‌‍‌‌​‍‌‌‍​​‌‌‍​‍‌‍​​‍‌​‌​​‌‍‌‍​‌‍‌​​‍‌​‍​‌‍‌‌​‌​​‌​‍‌​​‍​‌​​​​​‍‌​‍‌​‍‌​​​‌‍​‍​​‍​‌‌‍‌​​‍​​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌‍​‌‌‌‌‌‌​‌‍‍​‌‍‌​‍​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌‍‌‌‌‌‍​‌‍​‌​‍‌‍​‌‌‍‌‌‍‌‌​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌
22.12.2019

Wonder why a MutableList<Cat> isn't a subtype of MutableList<Animal>? Ever seen the "in" and "out" modifiers in Kotlin and wondered what they do? Let's find out!​​​​‌‍​‍​‍‌‍‌​‍‌‍‍‌‌‍‌‌‍‍‌‌‍‍​‍​‍​‍‍​‍​‍‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‍‍‌‌‍​‍​‍​‍​​‍​‍‌‍‍​‌​‍‌‍‌‌‌‍‌‍​‍​‍​‍‍​‍​‍‌‍‍​‌‌​‌‌​‌​​‌​​‍‍​‍​‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‍‌‌‍‍‌‌​‌‍‌‌‌‍‍‌‌​​‍‌‍‌‌‌‍‌​‌‍‍‌‌‌​​‍‌‍‌‌‍‌‍‌​‌‍‌‌​‌‌​​‌​‍‌‍‌‌‌​‌‍‌‌‌‍‍‌‌​‌‍​‌‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‍‌‌‍‌​​‌‌‍​‌​‍​​‌‍​​​​​​‌‍‌‌‌‍​‌‌‍​‍​‍‌‌‍‌​​​​​‌‌‍‌​​‍‌​‌​​​‍​‌​‌‍​‍‌​‍​‌‍‌​‌‍‌‍‌‍​‌​‍‌​‌‍‌‍‌​‌‍​​​​‌‍‌​‌‍‌‌​‍​‌‍​‌​​​​‍‌​‌‍​‌‍​‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌​‌‍‌‌‌​‌‍​‌​‍‌‍‍‌‌​​‌‌​‌‍‍‌‌‍‌‍‍​‌‍​‍‌‍​‌‌​‌‍‌‌‌‌‌‌‌​‍‌‍​​‌‌‍‍​‌‌​‌‌​‌​​‌​​‍‌‌​​‌​​‌​‍‌‌​​‍‌​‌‍​‍‌‌​​‍‌​‌‍‌‍​‍‌‍‌‌‌‍‍‌‍‍​‍‌‌‍​‍‌‍​‌‍‌‍‌‌‍‌​‍‌‌​‌‍​‌‌‍‍‌‍‍‌‌‌​‌‍‌​‍‍‌‌‍‌‍‌‌‌​‍‌‍​‌‍‌‌‌‍​​‍‍‌‍​‌‌​​‌​​​‍‌‍‌‍‍‌‌‍‌​​‌‌‍​‌​‍​​‌‍​​​​​​‌‍‌‌‌‍​‌‌‍​‍​‍‌‌‍‌​​​​​‌‌‍‌​​‍‌​‌​​​‍​‌​‌‍​‍‌​‍​‌‍‌​‌‍‌‍‌‍​‌​‍‌​‌‍‌‍‌​‌‍​​​​‌‍‌​‌‍‌‌​‍​‌‍​‌​​​​‍‌​‌‍​‌‍​‍‌‍‌‌​‌‍‌‌​​‌‍‌‌​‌‌​​‌‍‌​‌‌​​‍‌‍‌​​‌‍​‌‌‌​‌‍‍​​‌‌‍‌​‌‍‌‌‌​‌‍​‌​‍‌‍‍‌‌​​‌‌​‌‍‍‌‌‍‌‍‍​‍‌‍‌​​‌‍‌‌‌​‍‌​‌​​‌‍‌‌‌‍​‌‌​‌‍‍‌‌‌‍‌‍‌‌​‌‌​​‌‌‌‌‍​‍‌‍​‌‍‍‌‌​‌‍‍​‌‍‌‌‌‍‌​​‍​‍‌‌