I have problem, when i passing string variable to function.
I created interface MyMessageProps, which declare message on string,
later function MyMessage use this interface and return with this message.
When i adding React Component and trying add this function to button onClick error appear.
interface MyMessageProps {
message: string;
}
function MyMessage({ message }: MyMessageProps) {
return <div>i shall speak! my message is: {message}</div>;
}
class App extends Component {
render() {
const variable = 'test';
return (
<div>
<button onClick = {() => MyMessage(variable)}></button>
</div>
);
}
}
export default App;

const variable = {message: 'test'}instead? That's what the error message implies, anyway.