change to class

This commit is contained in:
2024-03-03 02:53:49 +08:00
parent 6f896c8695
commit 14b302bd1a
3 changed files with 27 additions and 11 deletions
+19 -10
View File
@@ -1,16 +1,25 @@
import { View, Text } from '@tarojs/components'
import { useLoad } from '@tarojs/taro'
import './index.scss'
import { Component, ReactNode } from 'react'
export default function Index() {
class Index extends Component {
state = {
msg: "Hello World!"
}
useLoad(() => {
console.log('Page loaded.')
})
onReady() {
console.log("Index is ready");
}
return (
<View className='index'>
<Text>Hello world!</Text>
</View>
)
render(): ReactNode {
return (
<View>
<Text>
{this.state.msg}
</Text>
</View>
)
}
}
export default Index