codesandbox - 如何在codesandbox中为react+typescript+mobx添加装饰器支持?
问题描述
我希望能够在代码沙箱中的@observer
打字稿代码中使用 mobx。但是我收到此错误:
/src/content.tsx:目前未启用对实验性语法“decorators-legacy”的支持 (6:1):
4 | import { observer } from "mobx-react";
5 |
> 6 | @observer
| ^
7 | export class Particle extends React.Component {
我已经:
1) 添加依赖项
2)添加.babelrc
包含这些内容的文件
但我无法摆脱错误。我该如何解决?
解决方案
去File > Preference > Settings > Search "experimental"
然后检查Javascript › Implicit Project Config: Experimental Decorators
推荐阅读
- linux - 从文件中查找并返回 if 代码块
- bash - Bash,Systemd Service,命令替换 - 不能很好地一起玩
- dart - InheritedWidget - 在 navigator.push 之后在 null 上调用 getter
- android - 来自 JSON 的具有多种视图类型的回收器视图
- python - CPython中为什么会出现Stackoverflow
- webgl2 - 在 Frag 着色器中接收非规范化的输出纹理坐标
- c# - 在 DbSet 的自定义种子期间应用删除
- javascript - 在 db 中插入对象数组,仅获取控制台中的最后一个对象数据
- ruby - Ruby如何从同一命名空间中的类调用模块方法
- google-sheets - 在 Google 电子表格中转换带括号的电话号码