Local state

Every ViewComponentReflex component maintains its own local state

Current count: 0

Current count: 0

app/components/counter_component.rb

class CounterComponent < ViewComponentReflex::Component
  def initialize
    @count = 0
  end

  def increment
    @count += 1
  end
end