Display Computed Data Using Recoil Selectors in React

Share this video with your friends

Send Tweet

In this lesson, we're going to show how RecoilJS selectors are used to display computed data in React. While atoms are the go-to state objects in Recoil, selectors are the ideal choice when data can be computed based on existing state - like displaying the price of a restaurant order. And your selector output always remains up to date - just subscribe to it using one of the RecoilJS hooks.

apolis
apolis
~ 4 years ago

Sum the prices: It should be (sum, current) => sum + current not (current, sum) => current + sum Although the result is the same.