package com.example.playscalajsreact.model import monocle.macros.Lenses import japgolly.scalajs.react.Reusability import japgolly.scalajs.react.Reusable @Lenses final case class Data(int: Int, str: String) object Data { implicit val reusability: Reusability[Data] = Reusability.derive // Here we wrap the lenses in Reusable.byRef so that React can compare setState/modState functions and know when its // it's got the same lens as a previous render. This is required to make [Method 1] work with Reusability object reusableLens { val int = Reusable.byRef(Data.int) val str = Reusable.byRef(Data.str) } }