R
R
RomanSS2019-05-31 14:57:55
JavaScript
RomanSS, 2019-05-31 14:57:55

How to write in ReactJs a component for a news block with different functionality?

I wanted to make a component for the news block, but there were problems that I don’t know how to solve correctly and without hacks.
Initially, the task was to load data from the database. An object comes from the base

{
    title: "название статьи",
    html: "тут html код сверстанной страницы"
}

All this was done through the dangerouslySetInnerHTML insert. (yes, it is desirable not to use it, but it was the fastest option)
Now with the expansion of the functionality, I need to use various ready-made modules that are easily loaded via import in this component, but due to the fact that I insert the code through dangerouslySetInnerHTML, access these functions impossible. How do I change the component and the html insert so that I can use the functions in the context of that component?
It would not be desirable to carry out in global area of ​​visibility.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-06-01
@grinat

eval

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question