easy-peasy icon indicating copy to clipboard operation
easy-peasy copied to clipboard

Which syntax is preffered. To destruct values or not?

Open 1alexvash opened this issue 4 years ago • 0 comments

Using destruction:

const { username, posts, messages} = useStoreState((state) => state);

Or accessing a value directly

const username = useStoreState((state) => state.username);
const posts = useStoreState((state) => state.posts);
const messages = useStoreState((state) => state.messages);

I heard there is a some difference in performance, if that's true which approach is better, and how significant it actually is?

1alexvash avatar Nov 19 '21 09:11 1alexvash