G
G
Gimir2020-02-17 10:49:25
React
Gimir, 2020-02-17 10:49:25

Where to store your functions in a React project?

Good afternoon, I have several functions that are not tied to any component, where to store such functions in the project? I don't want to litter the components with unnecessary declarations. Is there any practice? I didn't find it on google.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Prokhorov, 2020-02-17
@Gimir

If you use these functions only in components, make a separate lib or helpers folder, for example, in the root of the component directory or, for example, in / src like these / src / lib or / src / helpers and connect from there in those components where you like and not only components, if needed elsewhere.
As a rule, it is necessary to determine the semantic load of your functions and possibly start from here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question