React and the spread operator

0 views
Skip to first unread message

Mike Austin

unread,
Apr 23, 2026, 5:09:23 PM (4 days ago) Apr 23
to PiLuD
I use the spread operator in React everywhere, allowing me to delegate properties without boilerplate. Adding a new database field "archived":

type Item:
+ archived: boolean

GraphQL Query:
+ archived

BacklogItem:
+ archived
+ archived: boolean
+         {archived && (
+           <Icon light icon={TrashIcon} size={14} />
+         )}

I used to be on the fence with spreading props from data, but I control all the data transformations so a prop change won't affect components.
Reply all
Reply to author
Forward
0 new messages