-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove slightly unnecessary
<span>
tag
- Loading branch information
1 parent
e83c8d1
commit aa68b3f
Showing
1 changed file
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,34 +197,37 @@ class TreeNode extends React.Component { | |
const clickable = onClick.toString() !== TreeNode.defaultProps.onClick.toString(); | ||
const inputId = `${treeId}-${value.split(' ').join('_')}`; | ||
|
||
return ( | ||
<span> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jakezatecky
Author
Owner
|
||
<label htmlFor={inputId}> | ||
<NativeCheckbox | ||
checked={checked === 1} | ||
disabled={disabled} | ||
id={inputId} | ||
indeterminate={checked === 2} | ||
onChange={this.onCheck} | ||
/> | ||
<span className="rct-checkbox"> | ||
{this.renderCheckboxIcon()} | ||
</span> | ||
{!clickable ? children : null} | ||
</label> | ||
{clickable ? ( | ||
<span | ||
className="rct-node-clickable" | ||
onClick={this.onClick} | ||
onKeyPress={this.onClick} | ||
role="link" | ||
tabIndex={0} | ||
> | ||
{children} | ||
</span> | ||
) : null} | ||
</span> | ||
); | ||
const render = [( | ||
<label htmlFor={inputId}> | ||
<NativeCheckbox | ||
checked={checked === 1} | ||
disabled={disabled} | ||
id={inputId} | ||
indeterminate={checked === 2} | ||
onChange={this.onCheck} | ||
/> | ||
<span className="rct-checkbox"> | ||
{this.renderCheckboxIcon()} | ||
</span> | ||
{!clickable ? children : null} | ||
</label> | ||
)]; | ||
|
||
if (clickable) { | ||
render.push(( | ||
<span | ||
className="rct-node-clickable" | ||
onClick={this.onClick} | ||
onKeyPress={this.onClick} | ||
role="link" | ||
tabIndex={0} | ||
> | ||
{children} | ||
</span> | ||
)); | ||
} | ||
|
||
return render; | ||
} | ||
|
||
renderLabel() { | ||
|
Replacing the
<span>
element with an array triggers the warningEach child in an array or iterator should have a unique "key" prop.
. Do you mind to add thekey
attribute (or to revert the commit)? Thanks.