Skip to content

document not defined error #109

@mikeroosa

Description

@mikeroosa

This is most likely something I'm doing wrong but I can't figure it out. I've followed the tutorial on the reactjs.net site and all is working great until I try the server side rendering.

Here is the error and stack trace.

Error while loading "~/Scripts/Tutorial.jsx": ReferenceError: document is not defined
at Script Document [7]:111:5 -> document.getElementById('content')
Line: 111
Column:5

at React.ReactEnvironment.EnsureUserScriptsLoaded()
at React.ReactEnvironment.CreateComponent[T](String componentName, T props, String containerId)
at React.Web.Mvc.HtmlHelperExtensions.React[T](HtmlHelper htmlHelper, String componentName, T props, String htmlTag, String containerId)
at ASP._Page_Views_Home_Index_cshtml.Execute() in c:\Code\ReactDemo\ReactDemo\Views\Home\Index.cshtml:line 13
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)

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