E
E
Egor Telnov2019-08-23 16:43:51
JavaScript
Egor Telnov, 2019-08-23 16:43:51

Do I need to move the logic related to communication with the back to a separate file?

Hello. Learning to work with React. I decided to write a small sports application for myself. To communicate with the backend, I use the socket.io library. The question is where exactly you need to connect this library. In each component where is it required? Or include in app.js and then pass through props. Or is it better to take everything out as a separate file, and then connect it where it is needed?
I need advice from experienced programmers

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Julia, 2019-08-23
@telnov_magic

Look towards React Hooks and Context API
https://medium.com/@alexboots/using-react-context-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question