Z
Z
Zbiten2018-02-24 10:36:57
JavaScript
Zbiten, 2018-02-24 10:36:57

How to change any data on click?

I want to implement an image carousel, do I understand correctly that in order for something to change (re-render) on the page, I have to change the value in the state?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-02-24
@Zbiten

Render is called automatically in case of:
- state changes - props
changes
- forceUpdate (I have never had to use it yet)
So, yes, you understand correctly (if we are talking about "re-rendered"). And then, you can get to the bottom that if you have a desire, you can bypass React simply by accessing the DOM to change the src of the picture, etc. (this is hardly needed in this answer, but there is such a possibility).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question