VibeShare
A showcase for getSignalTower
(working name).
The Terminal component is a child to this Home component in src/app/page.tsx
It is conditionally rendered based on the state of shouldTerminalDisplay
which is toggled by the button below.
The Home component is re-rendered when any of these three states are updated (useSate) appData
, shouldTerminalDisplay
, inputValue
(onChange).
The terminal is passed an initial prop appData?.terminalMsg ?? 'no message'
.
However the Terminal subscribes to the signal terminalMsgReceived
and re-renders whenever a new message is dispatched.
You can change the message by clicking the 'dispatch' button as many times as you like.
It doesn't matter when the Terminal is rendered - it always displays the latest message.
The goal is to have a single source of truth for 'all' data in the app, but to avoid prop drilling and context API and still work seamlessly with React's render cycle.