Hey 👋🏽, I'm Yisar!
满血复活!没死就是还活着!
- 工作 remote,在青岛
- 独立开发c站,https://app.clicli.cc
:octopus: Resumable SSR framework.
License: MIT License
满血复活!没死就是还活着!
看了源码 作者写的很好 修改下readme
1.中间件机制
2.module机制
3.继续完善Proxy
你也可以试试react-control-center, https://juejin.im/post/5c70c700f265da2d8c7dcde3
I think you meant destroy
not destory
?
Lines 42 to 45 in 6d50710
I noticed you tagged the repo with "angular" and "svelte" - although the description says "subset of Vue".
Will this have precise updates like Svelte? No virtual DOM?
Looks interesting. I'm always curious to see what you come up with. 🙂
关于<hooks 是否需要状态管理>,先看这篇我的回答:
https://www.zhihu.com/question/311822358/answer/598799280
差不多就是,不需要了……但是我们可以利用 hooks 来一次稍微大一点的手术
其实我一直在 react 内想做的是,将劫持(Proxy)引入 react,smox 是个入侵不重的引入方式(相对 mobx)而言
我在我的另一个框架 fre 的初始版本中,也企图使用劫持实现类似的 API,然后失败了
但是 smox 这边我突然觉得可以继续做下去
比如,以下的 API:
import { useData, useObserver } from 'smox'
function Counter() {
const data = useData({ count: 0 })
return useObserver(() => (
<div>
{data.count}
<button onClick={() => data.count++}>+</button>
</div>
))
}
和 vue-hooks 非常像,区别在于 vue-hooks 多了一个包裹函数,逼格瞬间没了
期望的结果是,我们的组件,除了 useState 这种状态管理的形式,还有 useData,后者是劫持的方式
使用 smox 这部分 API,给 react 的 hooks 生造一个劫持的功能
哦对,useObserver 接受一个函数,它负责将这个函数变成可观察的,和 mbox 的 autorun 作用一样
讨论:要不要这么搞?还有没有更好的 API 设计?
#所有用到store中的状态的组件都直接这样传一个store.state进去,如果只是修改了其中的某一个状态,会引起其他没用到这个状态的组件也更新,会引发很多意想不到的问题
1. 移除 New Context API,使用 react hooks (useContext)
react 16 的 New Context API 有一定的局限性,比如无法在 componentDidMount 中引入 ,比如 <Context.Consumer> 等 hoc 会造成组件树的臃肿
2.使用 react 自带的一些 hooks ,比如 useReducer ……
我已经预感到,原先 1kb 的 smox ,这下可能缩减到……没几行代码了呜呜呜
这两天满课,预计周六开始搞::>_<::
顺便——
**会趁机发一个 react+smox 的 ssr 框架 **
结合 c 站 ssr 同构,我会给出一个性能超好的 ssr 解决方案。
大概:
1.封装Provider,使它不用传value
2.增加一个unsubscribe
确定不加的:
1.不加immutable,可以自己加,不需要整合进库
2.不加create-context,不打算兼容低版本
还有啥,求issue呀!
for (var i = 0; i < 26; i++) {
for (var j = 0; j < 26; j++) {
for (var k = 0; k < 26; k++) {
let name =
String.fromCharCode(65 + i) +
String.fromCharCode(65 + j) +
String.fromCharCode(65 + k)
post('https://github.com/signup_check/username?suggest_usernames=true', {
authenticity_token: 'u7gQqTDK7gVPXo0w6J2p / ak8lFcrM 0a0GRgy / YZ4Ev1LjV2hFNFGVpJdirwkytQxHNHW8 Qeu6ruJy3CX4WJg==',
value: name
}).then(res=>{
console.log(res)
})
}
}
}
this.props.history.push('/login')为什么报错你
如题, 代码稍微野了一点
1.单元测试、
2.错误边界
3.低版本兼容(react15+ ie9+)
@Map({
state: ['todos'],
mutations: ['query'],
actions: ['asyncQueryTodo']
})
componentWillMount() {
console.log(this.props); // {}
//this.props.asyncQueryTodo();
}
componentDidMount() {
console.log(this.props) // {}
}
那怎么在组件初始化的时候调用actions的方法呢
多个store 集合 怎么写啊 就像 多个 Reducer 集合一起
如题
有这两个属性,一切需求都不再是问题!
Hello, it seems a js.org
subdomain that was requested to target this repository no longer works.
The subdomain requested was smox.js.org
and had the target of 132yse.github.io/smox
.
It produced the following failures when tested as part of the cleanup:
To keep the js.org
subdomain you should add a page with reasonable content within a month so the subdomain passes the validation.
Failure to rectify the issues will result in the requested subdomain being removed from JS.ORGs DNS and the list of active subdomains.
If you are wanting to keep the js.org
subdomain and have added reasonable content, YOU MUST reply to the main cleanup issue with the response format detailed at the top to keep the requested subdomain.
🤖 Beep boop. I am a robot and performed this action automatically as part of the js.org cleanup process. If you have an issue, please contact the js.org maintainers.
API很漂亮,能否使用最新的hook?
1.namespace 需不需要显式设置
2.单 model 和 多 model 是否 API 要区分
这个 api 应该被 map 代替了吧,和文档其他地方不一致
In Vue, watch
has source param, It will be a getter or a ref:
watch(ref, ()=>console.log(111))
It will return a cleanup:
const cleanup = watch()
This only happens while the component is initializing.
I want to add an API, similar to useeffect
, to implement the life cycle at one time.
So……first, move soure to the end params:
watch(()=>console.log(111), [])
Second, return cleanup inside the callback:
watch(()=>{
console.log('effect')
retrun () => cleanup()
}, [])
This is consistent with useeffect and more ergonomic.
So shall we change the API name, such as
watch => effect
useEffect(() => {
const t = setTimeout(() => console.log(1), 1000)
return () => clearTimeout(t)
}, [])
I see the smox
documents is host on https://smox.js.org
. I want to know how to apply the smox.js.org
domain name ?
按照官网文档的写法,在组件中引用点击按钮出错
在入口文件绑定了store了
import React from 'react';
import {NavLink} from 'react-router-dom';
import { map } from 'smox';
@Map({
state: ['count'],
mutations: ['add', 'cut'],
actions: ['asyncAdd']
})
export default class Share extends React.Component{
constructor(props) {
super(props);
}
render () {
console.log(this.props); // 这里打印两次
return (
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.