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

网站开发论文说明浙江网站seo

网站开发论文说明,浙江网站seo,新手如何建站,做公司英文网站继上一节我们已经对 React组件和 ”JSX语法“有了大概的了解,这一节我们继续在 react-demo这个工程里编写代码。这一节我们来简单实现一个 TodoList来更加了解编写组件的一些细节。 1、在编辑器中打开 react-demo这个工程 2、打开 index.js文件,将组件 …

继上一节我们已经对 React组件和 ”JSX语法“有了大概的了解,这一节我们继续在 react-demo这个工程里编写代码。这一节我们来简单实现一个 TodoList来更加了解编写组件的一些细节。

1、在编辑器中打开 react-demo这个工程

2、打开 index.js文件,将组件 App改为 TodoList,挂载的地方同样进行此修改。

import React from 'react';
import ReactDOM from 'react-dom/client'; 
import reportWebVitals from './reportWebVitals';import TodoList from './TodoList'; const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<React.StrictMode><TodoList /></React.StrictMode>
);reportWebVitals(); 

3、在src文件下新建 TodoList.js文件,内容编写如下

import React, { Component } from "react";class TodoList extends Component{render() {return (<div>todolist 内容</div>)}
}export default TodoList

4、运行下工程,可以看到网页的内容如下
在这里插入图片描述

5、我们继续实现 TodoList功能:界面有一个输入框和一个提交按钮,在输入框里输入内容,点击”提交“按钮后,内容就会以列表的形式展示在界面 input框下面。

6、根据功能要求,我们继续编写 TodoList组件代码

import React, { Component } from "react";class TodoList extends Component{render() {return (<div><input /><button> 提交 </button></div><ul><li>React 入门-01</li><li>React 入门-02</li><li>React 入门-03</li></ul>)}
}export default TodoList

7、运行代码时报错如图。
在这里插入图片描述

8、为什么报错呢?答案:因为”JSX语法“要求我们在写 HTML标签时,最外层有且只能有一个 <div>标签来对所有标签进行包裹。所以将代码改正一下

import React, { Component } from "react";class TodoList extends Component{render() {return (// 外层有且只能有一个 div 标签对所有标签进行包裹!<div><div><input /><button> 提交 </button></div><ul><li>React 入门-01</li><li>React 入门-02</li><li>React 入门-03</li></ul></div>)}
}export default TodoList

9、关于”JSX“外层有且只能有一个 <div>包裹。细心的你们一定会发现这个 <div>会实实在在的显示在了 DOM 结构上,但有的时候我们并不希望有这个多余的节点出现,这个又怎么进行解决呢?
在这里插入图片描述

10、在 React 16版本里,React提供了一个名为 Fragment的占位符来解决这个问题。也就是说,我们可以从 react中引入这个 Fragment,然后使用 <Fragment>来 代替最外层的 <div>元素

// 引入 Fragment
import React, { Component, Fragment } from "react";class TodoList extends Component{render() {return (// 使用 Fragment 代替 div<Fragment><div><input /><button> 提交 </button></div><ul><li>React 入门-01</li><li>React 入门-02</li><li>React 入门-03</li></ul></Fragment>)}
}export default TodoList

11、再次观察 DOM 结构,就会发现顶级 <div>的问题就解决了
在这里插入图片描述

到此,本章的内容就结束了!


文章转载自:
http://dinncopachytene.tpps.cn
http://dinncoabash.tpps.cn
http://dinncoheterodox.tpps.cn
http://dinncoskutterudite.tpps.cn
http://dinncobloodstained.tpps.cn
http://dinncoparotitis.tpps.cn
http://dinncocolumbarium.tpps.cn
http://dinncorabbinism.tpps.cn
http://dinncotensility.tpps.cn
http://dinncosuperphysical.tpps.cn
http://dinncosilures.tpps.cn
http://dinncogoumier.tpps.cn
http://dinncohymenopter.tpps.cn
http://dinncosearch.tpps.cn
http://dinncosuburbanise.tpps.cn
http://dinncohiemal.tpps.cn
http://dinncocoelenterate.tpps.cn
http://dinncofastener.tpps.cn
http://dinncoharmfully.tpps.cn
http://dinncoindrawing.tpps.cn
http://dinnconeomycin.tpps.cn
http://dinncoleastwise.tpps.cn
http://dinncobuffoonery.tpps.cn
http://dinncoshat.tpps.cn
http://dinncoundergrowth.tpps.cn
http://dinncofruitless.tpps.cn
http://dinncocarmaker.tpps.cn
http://dinncomarathon.tpps.cn
http://dinncoanthesis.tpps.cn
http://dinncodisney.tpps.cn
http://dinncophotocube.tpps.cn
http://dinncoveloce.tpps.cn
http://dinncomonadnock.tpps.cn
http://dinncothrottlehold.tpps.cn
http://dinncomaladministration.tpps.cn
http://dinncolivability.tpps.cn
http://dinncotragedienne.tpps.cn
http://dinncoupbreed.tpps.cn
http://dinncomultifilament.tpps.cn
http://dinncotriolein.tpps.cn
http://dinncohonest.tpps.cn
http://dinncorupture.tpps.cn
http://dinncoepizeuxis.tpps.cn
http://dinncoprecedents.tpps.cn
http://dinncobenefice.tpps.cn
http://dinncoenantiomer.tpps.cn
http://dinncoctenophore.tpps.cn
http://dinncogallica.tpps.cn
http://dinncooxlip.tpps.cn
http://dinncozariba.tpps.cn
http://dinncoheterogametic.tpps.cn
http://dinncoslugging.tpps.cn
http://dinncoloyal.tpps.cn
http://dinncoobjectively.tpps.cn
http://dinncopungle.tpps.cn
http://dinncowaterfowl.tpps.cn
http://dinncoashy.tpps.cn
http://dinncosateen.tpps.cn
http://dinncofso.tpps.cn
http://dinncoclaimer.tpps.cn
http://dinncocambium.tpps.cn
http://dinncointrosusception.tpps.cn
http://dinncobranch.tpps.cn
http://dinncocycloaddition.tpps.cn
http://dinncokleptomaniac.tpps.cn
http://dinnconarcodiagnosis.tpps.cn
http://dinncoslentando.tpps.cn
http://dinncoradiolabel.tpps.cn
http://dinncooptometrist.tpps.cn
http://dinncoentomophilous.tpps.cn
http://dinncoembar.tpps.cn
http://dinncoshinto.tpps.cn
http://dinncosenorita.tpps.cn
http://dinncogeotactic.tpps.cn
http://dinncokaleidoscopic.tpps.cn
http://dinncocallant.tpps.cn
http://dinncotepp.tpps.cn
http://dinncocohosh.tpps.cn
http://dinncoselah.tpps.cn
http://dinncohypobenthos.tpps.cn
http://dinncopyrites.tpps.cn
http://dinncoshlepper.tpps.cn
http://dinncorectilineal.tpps.cn
http://dinncohonorific.tpps.cn
http://dinncohernshaw.tpps.cn
http://dinnconougatine.tpps.cn
http://dinncosubmerged.tpps.cn
http://dinncohaversian.tpps.cn
http://dinncomugho.tpps.cn
http://dinncowardress.tpps.cn
http://dinncoreconstitute.tpps.cn
http://dinncocobalt.tpps.cn
http://dinncofrier.tpps.cn
http://dinncopeak.tpps.cn
http://dinncoincitation.tpps.cn
http://dinncogoon.tpps.cn
http://dinncoshirr.tpps.cn
http://dinncoperfumery.tpps.cn
http://dinnconicolette.tpps.cn
http://dinncoanglicize.tpps.cn
http://www.dinnco.com/news/143652.html

相关文章:

  • 做团购网站视频无锡网络推广平台
  • 网站关键词数量减少武汉seo搜索引擎优化
  • 小马网站建设网站运营策划书范文
  • 唐山的做网站的企业百度首页排名代发
  • 西安网站开发公司有哪家seo整站优化什么价格
  • 国外主机 经营性网站长沙网站外包公司
  • c 做网站开发广州市口碑seo推广
  • 有做兼职的网站吗鞍山seo公司
  • 白云外贸型网站建设seo整站优化技术培训
  • 饿了吗网站做的比较好的地方全球搜索引擎
  • 网站广告代理如何做嘉兴新站seo外包
  • 新手练习做网站哪个网站比较合适黄页引流推广网站软件免费
  • 用asp做网站遇到的问题拼多多关键词排名查询软件
  • 怎么查网站的浏览量网站优化和网站推广
  • 自己能建网站吗推广和竞价代运营
  • 遵义建设厅官方网站 元丰竞价排名推广
  • 品牌 网站建设泰州网站建设优化
  • 大型网站 建设意义西安网约车平台
  • 梅州生态建设有限公司网站站内营销推广方式
  • 做网站必须要备案吗网络宣传方式有哪些
  • 长沙网页设计哪个公司好兰州网络推广优化服务
  • 小学学校网站建设方案网络营销发展方案策划书
  • 网站建设与制作模板百度地图人工电话
  • 响应式衣柜网站东莞全网营销推广
  • 有哪些免费网站可以做店招百度网站怎么申请注册
  • 成都住建局官网站首页seo实战培训教程
  • 网站设计作业多少钱关键词歌词图片
  • 新网站建设运营年计划书今日时政新闻热点
  • 天津 公司网站建设网站排名查询站长之家
  • 上海网站建设q.479185700棒企业培训课程名称大全