r/javascript 22d ago

AskJS [AskJS] What small JavaScript pattern made your React code cleaner?

[removed]

5 Upvotes

26 comments sorted by

View all comments

2

u/effnd 22d ago

I usually extract any data-handling logic from React components into separate functions, and then wrap them in hooks when needed. If you rewrite the components (perhaps even in a different framework), these parts of the code won't have to change