reactjs - Update through React.render gives strange results -


i'm writing web app using react, , due way ui framework works need use multiple react components mounted divs in thew html. update these divs call react.render again update different components.

this works on own machine, deploy minimized version on location http://svdoever.github.io/trainercoach strange behaviour.

reproduction steps:

  1. navigate http://svdoever.github.io/trainercoach
  2. click hamburger menu
  3. select item in menu (opens exercises set)
  4. at bottom press ">" next button
  5. a reload of app seems occur

the initial rendered html is:

initial rendering

after selecting ">" next button calls renderexercise(), there seems kind of "reload" of whole app within new generated div:

strange rendering after call react.render update component

the new introduced div is:

<div data-title="http://svdoever.github.io/trainercoach/" id="1452577160" class="panel active" data-crc="1452577160" style="z-index: 10;">

and div contains kind of stuff whole rendered page, tag defined in tag.

react sees mismatching server-side rendering , comes error:

warning: react attempted reuse markup in container checksum invalid. means using server rendering , markup generated on server not client expecting. react injected new markup compensate works have lost many of benefits of server rendering. instead, figure out why markup being generated different on client or server: (client) <ul class="list ins (server) <ul class="list ins

in opinion there should update, no introduction of new div.

the relevant code:

    function renderindex(source) {         var context = { rooturi: source.substring(0, source.lastindexof( "/" )) };         $.get(source + "?v=" + math.random().tostring(), function (indexmarkdown) {             $.afui.hidemask();             var indexmanager =  new indexmanager(source, indexmarkdown, this.rooturi);             react.render(<index key="index" indexmanager={indexmanager}/>, document.getelementbyid('mountindexleftmenu'));         }.bind(context));     }      function renderexercises(source) {         var context = { rooturi: source.substring(0, source.lastindexof( "/" )) };         $.get(source + "?v=" + math.random().tostring(), function (exercisesmarkdown) {             $.afui.hidemask();             var exercisemanager =  new exercisemanager(source, exercisesmarkdown, this.rooturi);             renderexercise(exercisemanager);         }.bind(context));     }      function renderexercise(exercisemanager) {         react.render(<exercisesheader key="exerciseheader" exercisemanager={exercisemanager}/>, document.getelementbyid('mountappheader'));         react.render(<exercises key="exercises" exercisemanager={exercisemanager}/>, document.getelementbyid('mountexercisesviewer'));         react.render(<exercisescontroller key="exercisescontroller" exercisemanager={exercisemanager}/>, document.getelementbyid('mountexercisescontroller'));     }      renderindex("https://raw.githack.com/wiki/svdoever/trainercoach/indexhotyoga.md"); 

strange thing behaviour occurs on minified project.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -