Quantcast
Channel: Active questions tagged strikethrough - Stack Overflow
Viewing all articles
Browse latest Browse all 86

How to make a variable in the state written with strikethrough when the checkbox is checked?

$
0
0

I need to make the description(which is the description of each to-do)written with strikethrough when the checkbox is checked and remove the strikethrough when it is unchecked.Here's what I have reached, I have 2 components the first is the Todo Form and the second is the ListItems.

import ListItems from "./ListItems";class Todo extends Component {  constructor(props) {    super(props);    this.state = {      todoList: [],      newItem: "",      newDescription: "",      chkbox: false,    };  }....render() {    return (<div className="Todo"><form id="to-do-form"....</form><ListItems          ....          handleCheck={this.handleCheck}          chkbox={this.state.chkbox}></ListItems></div>

and Here is the second component in brief, I haven't implemented yet handleCheck

class ListItems extends Component {  render() {    const list_items = this.props.items;    return (<div><ul>          {list_items.map((item) => {            return (<li className="list-item" key={item.id}>                ...<input                  type="checkbox"                  defaultChecked={this.props.chkbox}                  onChange={this.props.handleCheck}                /><h>Description: </h><h><input                    type="text"                    value={item.description}                    onChange={(e) =>                      this.props.editDescription(item.id, e.target.value)                    }                  /></h>                ...</li>            );          })}</ul></div>    );  }}export default ListItems;

Viewing all articles
Browse latest Browse all 86

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>