Sobes.tech

What is the difference between controlled and uncontrolled components in React? When is it better to use uncontrolled components?

224

The developer received a JWT token after login. What should be done with it? Where is the best place to store the token — in localStorage or in a cookie? How to store the token in a cookie?

188

How to secure the sum calculation function if the backend can send incorrect data (undefined, strings instead of numbers)?

153

There are two components: App and Child. Child is inside App and wrapped in memo. In App, there is a user object passed to Child as a prop, and a button that changes count. What happens when you press the button? How to make Child not re-render?

149

Everything is done correctly: the backend set an HTTP-only cookie. But when refreshing the page, the cookie is lost. What could be the problem?

147

What makes RTK Query or React Query better than regular fetch for requests? How does the frontend understand when it needs to update data?

146

Task Two Sum: given an array of numbers and a target number, find the indices of two numbers whose sum equals the target. What is the complexity of your solution?

135

The backend receives tabular data in the form of an array of objects. Write a function to calculate the sum of the 'amount' field.

124

A beginner developer created one large useContext for the entire application and uses it in all components. What problems might they face? What tools can help overcome this problem?

123