我试图了解两者之间的区别:
React.useEffect(() => {
let timerId = Js.Global.setInterval(() => tick(), 1000);
Some(() => Js.Global.clearInterval(timerId));
});
React.useEffect0(() => {
let timerId = Js.Global.setInterval(() => tick(), 1000);
Some(() => Js.Global.clearInterval(timerId));
});
Run Code Online (Sandbox Code Playgroud)
它们都具有相同的类型签名并且都编译但useEffect0什么都不做:
// useEffect0 : unit => option(unit => unit) => unit
// useEffect : unit => option(unit => unit) => unit
Run Code Online (Sandbox Code Playgroud)
要使用https://reasonml.github.io/reason-react/blog/2019/04/10/react-hooks 上的示例,它使用useEffect但如果您更改它使用useState而不是useReducer您必须更改useEffect为useEffect0
原始版本使用useEffect0:
type action =
| Tick;
type state = {
count: int,
}; …Run Code Online (Sandbox Code Playgroud) 使用Docker For Mac,鱼壳,macOS 10.11
我试图运行以下命令: docker run -d -it --name=my-app-container -v $(pwd):/app -p 3000:3000 myapp
我收到以下错误:
$(...) is not supported. In fish, please use '(pwd)'.
fish: docker run -d -it --name=my-app-container -v $(pwd):/app -p 3000:3000 myapp
Run Code Online (Sandbox Code Playgroud)
通过回购和SO答案阅读,但不能让这个工作.有任何想法吗?谢谢.