preact-www
preact-www copied to clipboard
Differences to React: default state shape
class App extends Component {
render() {
console.log(this.state) // react: null | preact: {}
}
}
Can PR if you want to mention it.
tbh I never realized that was the case in React. Maybe we shouldn't both initializing it in preact either?
Yea was surprised by it. Here's the proof: React: https://codesandbox.io/s/qx8971z77w Preact: https://codesandbox.io/s/15jxo4x2q
IIRC this is corrected in Preact X.
Still {}
in Preact X: https://codesandbox.io/s/heuristic-bohr-t586n
We had null
for a while in X but changed it back to an empty object for size reasons 👍
good to know!