Tip: Uncaught Invariant Violation

Uncaught Invariant Violation: onlyChild must be passed a children with exactly one child.

Are you using Reagent and Bootstrap with ClojureScript, and getting this error?

In my case, the cause was that I had a when inside an OverlayTrigger. Seems like a no-no. Further testing showed you can’t have an if either. Looks like OverlayTrigger can only wrap data, not something that might change.

In my case the solution was simple enough, once I figured out the cause: I just extracted when to wrap the OverlayTrigger, instead of the other way around.


Published: 2016-09-26