O
O
Ostap2020-03-01 00:49:45
React
Ostap, 2020-03-01 00:49:45

Text variables in React.JS?

Hello.
For the first time I'm making a small one-page on react. There is a need to create variables containing text for the site. The question is how to do it correctly in order to have one file with all variables and then forward them to all components.
I understand that you need to create a file with a function that returns an object with these variables and then import this file into app.js from which we forward these variables to the remaining components.
I ask for help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Julia Ovod, 2020-03-01
@ovodovod

Ideally, for such situations, they usually use, for example, Redux or MobX , these are tools for organizing application data storage, read the documentation (there is a Russian translation for Redux ).

B
Bohdan Petrov, 2020-03-01
@mindyourlifeguide

As an option, create react.context and pass the necessary data through it.
Read the documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question