Skip to content

Instantly share code, notes, and snippets.

@danielfone
Created June 19, 2017 03:01
Show Gist options
  • Save danielfone/af59fa618c06267e8429bcfedc5a1de4 to your computer and use it in GitHub Desktop.
Save danielfone/af59fa618c06267e8429bcfedc5a1de4 to your computer and use it in GitHub Desktop.
render () {
return (
<div class="clearfix">
{/* = render 'inventories/show/quick_add_form' if policy(:campaign).new? */}
{/* = render 'inventories/show/table_legend' */}
</div>
{/* -
period_width = 5
panel_width = 23
-*/}
{/* # TODO: Some how make this less hacky. But we really need fix-width columns */}
<table class="table table-bordered table-condensed inventory small inventory-data-table" style="width: auto">
/* etc */
)
}
@gerardmrk
Copy link

You can only return a single JSX Element in the render method. You are currently returning 2 (<div> and <table>).
What you can do is encapsulate the current block in a div like this:

<div>
   <div class="clearfix">
        {/* = render 'inventories/show/quick_add_form' if policy(:campaign).new? */}
        {/* = render 'inventories/show/table_legend' */}
   </div>

   {/* -
        period_width = 5
        panel_width = 23
   -*/}
   {/* # TODO: Some how make this less hacky. But we really need fix-width columns */}
   <table class="table table-bordered table-condensed inventory small inventory-data-table" style="width: auto">
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment