Comments (12)
你应该是开启了es module,import时后缀必须指定。切换到commonJS方案可解决问题,或者在执行node时加上--experimental-specifier-resolution=node
也可解决问题。
我这边也看下如何解决在框架层面解决
from foca.
升级到 [email protected] 即可修复报错。之前都是在vite/webpack环境下使用,所以没有遇到node的问题
from foca.
升级到[email protected]就可以报修复错误。之前都是在vite/webpack环境下使用,所以没有遇到node的问题
升级到0.10.2解决了这个问题,但是新遇到了个问题就是next.js在node环境下运行没有localStorage和sessionStorage对象
from foca.
TypeError: Cannot destructure property 'store' of 'useReduxContext(...)' as it is null.
at useSelector (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-redux/lib/hooks/useSelector.js:50:7)
at useModel (file:///Users/linzeguang/Desktop/yyz/my-app/node_modules/foca/dist/index.mjs:756:10)
at Home (webpack-internal:///./src/pages/index.tsx:21:63)
at renderWithHooks (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5448:16)
at renderIndeterminateComponent (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5521:15)
at renderElement (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5736:7)
at renderNodeDestructive (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5875:11)
at renderNode (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6009:12)
at renderChildrenArray (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5965:7)
at renderNodeDestructive (/Users/linzeguang/Desktop/yyz/my-app/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5897:7)
wait - compiling /_error (client and server)...
wait - compiling...
event - compiled client and server successfully in 97 ms (210 modules)
error - TypeError: Cannot destructure property 'store' of 'useReduxContext(...)' as it is null.
还有遇到这个报错,在使用useModel的时候
from foca.
你是要使用persist吗?这个应该是个无解的问题,redux-persist之前也讨论过这个,rt2zz/redux-persist#1008 。
目前只能判断是否ssr,然后换成 memoryStorage 。之前有想过使用cookie来实现,但是不确定是否为业界标准方案
from foca.
TypeError: Cannot destructure property 'store' of 'useReduxContext(...)' as it is null.
是否在入口加上了 FocaProvider
标签?
from foca.
TypeError: Cannot destructure property 'store' of 'useReduxContext(...)' as it is null.
是否在入口加上了
FocaProvider
标签?
忘记添加了不好意思,文档里没体现就疏忽了,您这边看文档要不要补充一下。
from foca.
https://foca.js.org/#/store?id=%e5%85%a5%e5%8f%a3
文档都有的
from foca.
SSR的持久化这块可以讲讲你的需求,我收集一下,这样做出来的功能也更符合用户习惯。
from foca.
哦哦看到了,不好意思哈,感谢
from foca.
好的,希望这个库能让你准时下班,我这几天把nextjs的demo也放上去
from foca.
经过一段时间研究,发现foca暂时无法用在nextjs中。原因是store是单一的,而node进程是内存常驻的,这意味着store会被所有请求共享。我将在文档中体现这个问题。感谢体验以及非常抱歉
同时,通过查找资料,发现next.js不是唯一的seo解决方法,可以看看这篇文章:https://markdowner.net/article/73058307795021824
from foca.
Related Issues (20)
- watch特性 HOT 1
- Cannot find namespace 'NodeJS' HOT 3
- tarojs/components 组件标红! HOT 9
- add support of undefined type in initialState HOT 4
- 如何在modelA里访问modelB的数据? HOT 4
- 使用时出现action in action的小问题 1.0.0 HOT 23
- 一定要在 effects 中使用 this.setState 或者 先定义 actions 方法调用才能更新状态吗 HOT 6
- 关于持久化的版本号 HOT 7
- 多个loading的情况 HOT 1
- [New Feature]是不是可以增加一个即用即创建的功能 HOT 6
- [Improvement] reset的特性无需深拷贝 HOT 3
- [New Feature]响应式 支持对复杂对象的支持 HOT 2
- initialState参数很多,如何一次性setState更新? HOT 3
- actions,异步actions, reducer, methods, computed, watch 名称叫法 HOT 1
- 如何动态删除指定的缓存? HOT 1
- foca 2.0 规划
- 持久化没有把initvalue放进去 HOT 3
- onInit不会触发useLoading HOT 2
- taro 支付宝小程序不支持吗? HOT 9
- foca2 在低版本的手机有兼容问题,iphone6和部分oppo HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foca.