Skip to content

Context Issues with <Link> #982

Closed
Closed
@sgehly

Description

@sgehly

I'm using React-Router in order to generate links to route to dynamically-generated routes in a dynamically generated template area. Here's the code:

`ajax('GET','/content/template/'+template+'/master.html',function(tmp){
document.getElementById('template').innerHTML = tmp;

  var mop = document.getElementsByClassName("menu");
  for (var i = 0; i < mop.length; i++) {
      if(!mop[i].getAttribute('menu-name')){
        mop[i].innerHTML = '<li><a>Menu not found.</a></li>';
        return;
      }
      var mitems = menus[mop[i].getAttribute('menu-name')];
      for(var item in mitems) { 
        React.render(<Link to={mitems[item].route}>{mitems[item].text}</Link>, getAllElementsWithAttribute('menu-name',mop[i].getAttribute('menu-name'))[0]);
      }
  }

});`

All is well, and works well, until the final line of code, namely:
React.render(<Link to={mitems[item].route}>{mitems[item].text}</Link>, getAllElementsWithAttribute('menu-name',mop[i].getAttribute('menu-name'))[0]);

where, as I have seen in #400, and #513, gives
fjbbrvi

From what I have seen, this is a bug with context, however there are no cloneWithProps() in my application, and nothing seems that out of the ordinary. Any help with workarounds would be appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions