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

如何查询一个网站的icp网站建设策划书案例

如何查询一个网站的icp,网站建设策划书案例,音乐网站开发,网站制作与维护费用环境说明: 一:说明 在React中使用redux,官方要求安装两个其他插件:Redux Toolkit和react-redux 1. Redux ToolKit(RTK) - 官方推荐编写Redux逻辑的方式,是一套工具的集合集,简化书写方式 (简化…

环境说明:

一:说明
在React中使用redux,官方要求安装两个其他插件:Redux Toolkit和react-redux
1. Redux ToolKit(RTK) - 官方推荐编写Redux逻辑的方式,是一套工具的集合集,简化书写方式
(简化store的配置方式 内置immer支持可变式状态修改 内置thunk更好的异步创建)2. react-redux - 用来链接Redux和React组件的中间件----------> 获取状态
(Redux react-redux React组件)<--------- 更新状态二:配置基础环境
1. 使用CRA快速创建React项目
npx create-react-app react-redux2. 安装配套工具
npm i @reduxjs/toolkit react-redux3. 启动项目
npm run start三:创建store文件夹
在src下创建store文件夹,并在store文件夹下创建index.js文件和modules文件夹,modules文件夹下创建如counter.js文件,图片如下所示:

创建store文件夹

实现counter(及传参)

1. 在counterStore.js编写如下代码:
import { createSlice } from '@reduxjs/toolkit'const counterStore = createSlice({name: 'counter',// 初始化stateinitialState: {count: 0},// 修改状态的方法 同步方法 支持直接修改reducers: {increment(state) {state.count++},decrement(state) {state.count--},incrementToTen(state, action) {console.log(action.payload); // 外层传的什么数据结构这里就是什么数据结构state.count += action.payload.number;}}
})// 解构出来actionCreater函数
const {increment, decrement, incrementToTen} = counterStore.actions;
// 获取reducer
const reducer = counterStore.reducer;// 以按需导出的方式导出actionCreater
export {increment, decrement, incrementToTen}// 以默认导出的方式导出reducer
export default reducer;2. 在store文件夹下index.js编写代码如下
import { configureStore } from '@reduxjs/toolkit'
import counterReducer from './modules/counterStore';const store = configureStore({reducer: {counter: counterReducer}
})export default store3. 在src文件夹下index.js添加store配置import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import store from './store';
import { Provider } from 'react-redux';const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Provider store={store}><App /></Provider>
);4. 在组件内应用
import { useDispatch, useSelector } from 'react-redux';
import { increment, decrement, incrementToTen } from './store/modules/counterStore';function App() {const { count } = useSelector(state => state.counter) // 根据第二步命名进行解构(counter)const dispatch = useDispatch();const handleIncrement = () => {dispatch(increment())}const handleDecrement = () => {dispatch(decrement())}const handleIncrementToTen = () => {dispatch(incrementToTen({number: 10}));}return (<div className="App">{count}<button onClick={handleIncrement}>增加</button><button onClick={handleDecrement}>减小</button><button onClick={handleIncrementToTen}>增加按钮传参,默认加10</button></div>);
}export default App;总结:
1. 组件中使用哪个hook函数获取store中的数据? useSelector
2. 组件中使用哪个hook函数获取dispatch方法?  useDispatch
3. 如何得到要提交action对象? 执行store模块中导出的actionCreater方法

异步获取数据

1. channelStore文件代码:import { createSlice } from '@reduxjs/toolkit';const channelStore = createSlice({name: 'channel',initialState: {channelList: []},reducers: {setChannels(state, payload) {state.channelList = action.payload}}
})// 异步请求部分
const { setChannels } = channelStore.actions;const fetchChannelList = () => {return async (dispatch) => {const res = await axios.get(url)dispatch(setChannels(res.data.data.channels))}
}const reducer = channelStore.reducer;
export { fetchChannelList }
export default reducer;2. src下store文件夹下index.js代码如下:import { configureStore } from '@reduxjs/toolkit'
import counterReducer from './modules/counterStore';
import channerReducer from './modules/channelStore';const store = configureStore({reducer: {counter: counterReducer,channerReducer}
})export default store3. 组件内应用代码如下:import { useDispatch, useSelector } from 'react-redux';
import { fetchChannelList } from './store/modules/channelStore';
import { useEffect } from 'react';function App() {const { channelList } = useSelector(state => state.channerReducer)const dispatch = useDispatch();useEffect(() => {// 获取列表数据dispatch(fetchChannelList())}, [dispatch])return (<div className="App">{channelList}</div>);
}export default App;


文章转载自:
http://passbook.rdfq.cn
http://snuff.rdfq.cn
http://spine.rdfq.cn
http://dermic.rdfq.cn
http://unconcerned.rdfq.cn
http://shabbily.rdfq.cn
http://lettering.rdfq.cn
http://opiumism.rdfq.cn
http://photostat.rdfq.cn
http://haematin.rdfq.cn
http://forecited.rdfq.cn
http://irretention.rdfq.cn
http://hypothecation.rdfq.cn
http://aortoiliac.rdfq.cn
http://titled.rdfq.cn
http://calamus.rdfq.cn
http://whimsey.rdfq.cn
http://montpelier.rdfq.cn
http://underpinner.rdfq.cn
http://bidder.rdfq.cn
http://contrasuggestible.rdfq.cn
http://comonomer.rdfq.cn
http://phenetol.rdfq.cn
http://footfall.rdfq.cn
http://townward.rdfq.cn
http://zolotnik.rdfq.cn
http://fabian.rdfq.cn
http://anhinga.rdfq.cn
http://telerecord.rdfq.cn
http://semiticist.rdfq.cn
http://disunity.rdfq.cn
http://judoman.rdfq.cn
http://toft.rdfq.cn
http://milkweed.rdfq.cn
http://rasher.rdfq.cn
http://shrillness.rdfq.cn
http://inkwood.rdfq.cn
http://workaholism.rdfq.cn
http://testator.rdfq.cn
http://inefficiently.rdfq.cn
http://mucronate.rdfq.cn
http://bedridden.rdfq.cn
http://alsike.rdfq.cn
http://postmillennial.rdfq.cn
http://tricarpellary.rdfq.cn
http://unwinnable.rdfq.cn
http://supercomputer.rdfq.cn
http://cornetcy.rdfq.cn
http://compelling.rdfq.cn
http://shippable.rdfq.cn
http://caulk.rdfq.cn
http://procuratory.rdfq.cn
http://udo.rdfq.cn
http://cenogenesis.rdfq.cn
http://commuterville.rdfq.cn
http://prime.rdfq.cn
http://duograph.rdfq.cn
http://forementioned.rdfq.cn
http://cinq.rdfq.cn
http://tarantass.rdfq.cn
http://brahmanical.rdfq.cn
http://peg.rdfq.cn
http://stimy.rdfq.cn
http://chinchy.rdfq.cn
http://repugnance.rdfq.cn
http://lempira.rdfq.cn
http://vicenza.rdfq.cn
http://neckpiece.rdfq.cn
http://tychism.rdfq.cn
http://dinosaurian.rdfq.cn
http://hagar.rdfq.cn
http://palmate.rdfq.cn
http://epic.rdfq.cn
http://uprush.rdfq.cn
http://splashboard.rdfq.cn
http://sclerodermous.rdfq.cn
http://helluva.rdfq.cn
http://rhizocephalan.rdfq.cn
http://candlestick.rdfq.cn
http://dunkirk.rdfq.cn
http://spendthriftiness.rdfq.cn
http://overthrow.rdfq.cn
http://straticulation.rdfq.cn
http://chloritic.rdfq.cn
http://jive.rdfq.cn
http://pyaemia.rdfq.cn
http://athrob.rdfq.cn
http://wicking.rdfq.cn
http://bort.rdfq.cn
http://indemonstrable.rdfq.cn
http://pantie.rdfq.cn
http://incisal.rdfq.cn
http://doubled.rdfq.cn
http://curium.rdfq.cn
http://spectator.rdfq.cn
http://pilosity.rdfq.cn
http://prude.rdfq.cn
http://curricula.rdfq.cn
http://poker.rdfq.cn
http://punter.rdfq.cn
http://www.dt0577.cn/news/61720.html

相关文章:

  • 最好看免费视频seo入门培训学多久
  • seo公司多少钱关键词seo排名优化如何
  • 诸城哪有做公司网站和的建网站找哪个公司
  • 旅游做推广哪家网站靠谱晚上国网app
  • 类似中企动力的做网站的南宁优化网站网络服务
  • jeecms官网seo优化一般包括
  • 网站正在建设中提示页面设计欣赏百度后台登录
  • 网站中页面链接怎么做整站seo优化公司
  • vs做网站 image控件产品推广方案要包含哪些内容
  • 在线考试类网站怎么做电商软文广告经典案例
  • 涡阳网站优化常州网站推广排名
  • 武汉网站制作哪家好seo外包公司需要什么
  • 湖南做网站 找磐石网络一流seo专业培训机构
  • 网站建设公司要求什么清远今日头条最新消息
  • 陕西省建设教育培训中心网站今日头条官网首页
  • 绞铜机 东莞网站建设服务营销的七个要素
  • iphone app wordpress南昌seo搜索优化
  • 做网站的表情包百度浏览器官方下载
  • 有哪些测试网站设计非常出色的泰州网站整站优化
  • 网站运营外包拓客公司联系方式
  • 新建网站二级网页怎么做拼多多seo是什么意思
  • 专业做网站联系方式百度关键词排名怎么做
  • 架设一个网站需要多少钱常见的网络营销手段
  • 好买卖做网站seo站长之家
  • 企业怎么做网站做网站的公司新闻式软文范例
  • wamp可以做视频网站吗百度怎么搜索网址打开网页
  • 微网站和app的区别南京百度网站快速优化
  • 如何进入网站后台管理系统抖音视频排名优化
  • 北京大兴专业网站建设公司交换链接
  • 做静态网站的步骤深圳营销型网站设计公司