()
| 611 | const noteStore = store({ id: 5, title: "Story" }); |
| 612 | |
| 613 | function ConditionalComponent() { |
| 614 | const id = useStoreValue(idStore); |
| 615 | const title = useStoreValue(noteStore, (value) => { |
| 616 | if (id === value.id) { |
| 617 | return value.title; |
| 618 | } |
| 619 | }); |
| 620 | |
| 621 | return ( |
| 622 | <div> |
| 623 | <span data-testid="result">{title ?? "undefined"}</span> |
| 624 | <button |
| 625 | type="button" |
| 626 | data-testid="increment" |
| 627 | onClick={() => idStore.set((n) => n + 1)} |
| 628 | > |
| 629 | Increment |
| 630 | </button> |
| 631 | </div> |
| 632 | ); |
| 633 | } |
| 634 | |
| 635 | render(<ConditionalComponent />); |
| 636 |
nothing calls this directly
no test coverage detected