Closed karlkras closed 1 year ago
I think I'm showing the previous code in the recorded video but I updated it to not use
so after some further futzing, here's the "eslint suggested" version of that counter component:
import React, { Component } from "react";
export type CounterProps = { label?: string };
export type CounterState = { count: number };
export class Counter extends Component<CounterProps, CounterState> {
constructor(props: CounterProps) {
super(props);
this.state = { count: 0 };
}
render(): JSX.Element {
const { label = "Count" } = this.props;
const { count } = this.state;
return (
<div>
<span title="Count Label">{label}</span>
<span id="counter" title="Current Count">
{count}
</span>
</div>
);
}
}
As you probably see in the next section, when I'm modeling state, I tried to lead towards readonly enforcement.
We're archiving the current repository - if the issue is still relevant, would you mind opening it on https://github.com/JetBrains/guide ?
Many thanks, and sorry for any inconvenience.
(this is an automated message)
Hi Paul. So on this section: you are showing this code:
and this test:
as passing. However I'm getting this error:
how are you getting it to pass?