I am using <Checkbox> component in my react project. The code is
App.jsx
import React, { Component } from 'react'
import { connect } from 'react-redux';
import Checkbox from '../../../components/Checkbox/Checkbox.jsx';
class App extends Component {
render() {
return (
<div className="App">
<div style={{ 'float': 'left', 'background': 'white' }}><Checkbox
input={{
name: 'sampleName',
onChange: (e) => this.onSelect(e.target.checked),
value: allSelected
}}
/></div>
</div>
)
}
}
export default connect(
)(App);
Checkbox.jsx
import React from 'react';
import './Checkbox.scss';
class Checkbox extends React.Component {
render() {
const { input: {name, size, value, onChange}, disabled } = this.props;
return (
<div className="checkbox">
<input disabled={disabled} id={name} type="checkbox" value={value} onChange={onChange} />
<label htmlFor={name} className={size}/>
</div>
);
}
}
export default Checkbox;
I want to include one more attribute checked: {Item.Selected} to the <Checkbox> tag , for that what changes I needed to make in the Checkbox.jsx page to accepet the value of the attribute selected?
<input type="checkbox" checked={this.props.checked} .../>