I am just starting with the react-rails gem, and here is my below code that i need help. My _mounts.js.jsx,
var Mounts = React.createClass({
render () {
var showMounts = (mount, details) => <Mount name={mount.name} path={mount.mount_point} det={details} />;
return (
<div className="card">
<div className="card-main">
<div className="card-inner margin-bottom-no">
<p className="card-heading">Mount Points</p>
<div className="card-table">
<div className="table-responsive">
<table className="table table-hover table-stripe" >
<thead>
<tr>
<th>Mounted as</th>
<th>Path</th>
<th>Size</th>
<th>Mount/Unmount</th>
</tr>
</thead>
<tbody>
{this.props.mounts.map(showMounts}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
)
}
});
I am passing two props in my react_component,
<%= react_component "Mounts", { mounts: @mounts, mount_details: b} %>
@mounts is a Filesystem Object and b is an array.
My _mount.js.jsx file
var Mount = React.createClass({
render () {
var showMount = (mount) => <Mount name={mount} />;
if(this.props.det == "true"){
dat = "Unmount"
}
else{
dat = "Mount"
}
return (
<tr>
<td> {this.props.name}</td>
<td> {this.props.path}</td>
<td> Undefined Size</td>
<td>
{this.props.det}
</td>
</tr>
)
}
});
My {this.props.det} is displaying the array index values and not the values in the Index i.e(0,1,2,3).
I am a noob in React, any help is appreciated. Thanks in Advance.