Home > Blockchain >  'X' is declared but its value is never read. Having trouble understanding where to assign
'X' is declared but its value is never read. Having trouble understanding where to assign

Time:01-06

Button.tsx

import React from "react";

interface ButtonProps {
    name: string;
    onButtonClick: () => void;
}

function Button(props: ButtonProps) {
    const { name, onButtonClick } = props;

    function buttonAlert() {
        alert(`Testing`);
    }

    return (
        <div>
            <button className="buttonOne" onClick={buttonAlert}>{name}</button>
        </div>
    );
}

export default Button;

index.tsx

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Button from './Button';

ReactDOM.render(
  <React.StrictMode>
    <App />
    <Button name="Button One" onButtonClick={() => { alert(`You clicked on Button One!            
  • Related