当前位置: 首页 > article >正文

react中字段响应式

class中用法:
import React, { Component } from 'react'

// 我的-设置页
export default class Index extends Component<any, any> {

  constructor(props) {
    super(props)
    this.state = {
      settingInfo: {},
    }
  }

  async componentDidMount() {
    let settingInfo = await Service.getSettingInfo(this.context, {
      page_session_id: 'kUeombnhdm',
    })
    this.setState({ settingInfo: settingInfo })
  }

  render() {
    return <View style={{ marginTop: 50 }}>{this.state.settingInfo.errorMsg}</View>
  }
}

 

function中用法:
import React, { useEffect, useState } from 'react'

const Index = () => {
  const [driver, setDriver] = useState(false)
  useEffect(() => {
    setDriver(false)
  }, [])
  return <View className={styles.backgroundIcon}>{driver}</View>
}

export default Index


http://www.kler.cn/a/580488.html

相关文章:

  • springboot3整合knife4j详细版,包会!(不带swagger2玩)
  • 没有与此调用匹配的重载
  • 量子计算对区块链技术的影响:革新与挑战
  • 开源项目ESP-SparkBot: ESP32-S3 大模型 AI 桌面机器人(复刻分享)
  • 服务端和客户端通信(TCP)
  • OpenAI Whisper:开启语音转文本的智能时代
  • Unity DOTS 从入门到精通之传统 Unity 设计转换为 DOTS 设计
  • 驾培市场与低空经济无人机融合技术详解
  • HTML 表单 (form) 的作用解释
  • 【C++设计模式】第三篇:抽象工厂模式(Abstract Factory)
  • 行为模式---中介者模式
  • MATLAB中movsum函数用法
  • 使用AI一步一步实现若依前端(5)
  • Java直通车系列25【Spring Boot】(核心注解)
  • Spring boot 3.3.1 官方文档 中文
  • monaco-editor/react 自定义高亮
  • vue+dhtmlx-gantt 实现甘特图-快速入门【甘特图】
  • 天梯选拔赛赛后补题
  • Unet实战分割项目:深度学习与医学影像分析
  • 大语言模型 (LLM) 基础知识