Js.React.How react renders?

Rendered objects are immutable. Every rendered object like a frame from the movie.

It renders only those parts that have changed.


      <button onClick={onClickStartTimer}>
        start timer
      <button onClick={onClickStopTimer}>
        stop Timer 
      <div id="renderHere">



import ReactDOM from 'react-dom';

export let immutableExample = () => {

    const element = (
            <div>Testing immutable...</div>
            <div>{new Date().toLocaleTimeString()}</div>

    ReactDOM.render(element, document.getElementById("renderHere"));

let timer;

export let startTimer = () => {
   if (!timer)
     timer =  setInterval(immutableExample, 1000);

export const stopTimer = () => {
    if (timer)
      timer = null;
This entry was posted in Без рубрики. Bookmark the permalink.