Home > Back-end >  I have this code in react which have inline style of line-through on textDecoration when completed i
I have this code in react which have inline style of line-through on textDecoration when completed i

Time:01-14

The line-through function not working

CodePudding user response:

it seems the issue is that you are creating a regular variable instead of a react useState object. Try this code instead:

import React from "react";
import {useState} from "react";

const [x, setX] = useState(false);
function App () {
  return <button onClick={()=> {setX(x => !x)}} style={[your style as is]}>Buy Bughattis</button>
}

export default App;

also, whether or not this solves your problem, you should go read the link I shared in my comment on your post and fix this post up to follow the community guidelines, or delete this post.

  • Related