I am trying to display errors on the form if the ajax call to the form url fails. Below is my Admin
component:
AdminError
component component:
During debugging, I get the correct @ props.errorText value as "email address is not valid." But it does not appear on the page, and I collect this warning in the console: "Warning: input is a void element tag and should not have children
or use props.dangerouslySetInnerHTML
. Check the null rendering method." A screenshot of both the error and the page is attached.

I tried changing the AdminError component as follows, but this did not work:
#app/assets/javascripts/components/adminerror.js.coffee @AdminError = React.createClass getDefaultProps: -> errorText: "" render: -> dom.div className: 'help-block' dangerouslySetInnerHTML: __html: marked(@props.errorText.toString(), {saitize: true})
When I set a debug point on a line that returns a dangerous SetInnerHTML, I correctly get the value @props.errorText
, because "the message is invalid", and the value marked(@props.errorText.toString())
, because "
invalid
". but still the help box for the error is not displayed at all.
UPDATE: Made the following changes to the AdminError component
Application / assets / JavaScripts / components / adminerror.js.coffee
@AdminError = React.createClass getDefaultProps: ->
and the following changes have been made to the administration method in the Admin component:
if(@state.errorTexts.length>0) dangerouslySetInnerHTML: { __html: ReactDOMServer.renderToString( # for errorText, index in @state.errorTexts React.createElement AdminError, errorTexts: @state.errorTexts ) }
does not receive the warning anymore, but instead receives the following error:
Uncaught Invariant Violation: ReactCompositeComponent.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.