- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试整合 Carbon Design System - React SDK在寓言/Elmish 应用程序中,看起来我必须创建 property type definitions (其中一些我只是猜测)用于每个组件以便使用它。
组件已经has TypeScript definitions在。
我真的必须为我想尝试或使用的每个 React 组件手动创建类型定义吗?
是否有一种简单或自动的方法可以从 F# 代码中使用 React 组件,而不必为我想尝试的每个组件编写属性类型定义?
F# 社区中的人们如何使用 React 生态系统中的组件?
我试过 ts2fable但它会生成无效的不可靠代码:Example大多数行都有错误,我还转译了依赖项(typings/shared.d.ts
和 React 类型定义)
我也在看TypeProviders但不确定这是否可以解决我的问题。
最佳答案
Do I really have to manually create type definitions for every React component I want to try or use?
Is there a simple or automatic way to use a React component from F# code without having to write the property type definitions for every component I want to try?
How do people in the F# community use the components from the React ecosystem?
{
foo: 1,
bar: [ "a", "b", "c" ],
qux: "hello"
}
然后我们可以像这样在 Fable 中创建它:
open Fable
open Fable.Core
open Fable.Core.JsInterop
let props =
createObj [
"foo" ==> 1
"bar" ==> ResizeArray<_>([ "a"; "b"; "c" ])
"qux" ==> "hello"
]
编译成...
export const props = {
foo: 1,
bar: ["a", "b", "c"],
qux: "hello",
};
props
的F#类型是
obj
.
==>
运营商只是为了方便。你也可以这样写:
open Fable
open Fable.Core
open Fable.Core.JsInterop
let props =
createObj [
"foo", box 1
"bar", box (ResizeArray<_>([ "a"; "b"; "c" ]))
"qux", box "hello"
]
这非常适合尝试。但是,您将错过 F# 的一些强类型优势!这种权衡是否值得取决于您的用例。
关于reactjs - 在 Fable/Elmish 中使用第三方 React 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63299451/
我有这段代码,我正在使用 Fable Elmish 和 Fable remoting 连接到 Suave 服务器。我知道服务器由于 postman 而工作,并且此代码的变体确实调用了服务器 le
假设我嵌套了这样的 Elmish 组件:A包含 B包含 C . 那么如果 C有状态和消息,这些必须从 C 传递至 B然后到 A . 例如,B 的消息和模型类型可能: type Message =
我已经使用 dotnet new SAFE 命令设置了一个标准 SAFE 应用程序,生成了两个服务器和客户端项目(以及共享文件夹)。 Client 项目具有包含 View 函数和引导代码的 Clien
我有一个使用 websockets 在 SAFE-Stack 中构建的应用程序,或多或少地遵循以下方法:https://github.com/CompositionalIT/safe-sockets
(新手问题)。 在 Elmish.WPF 中,我有一个父模块 App,包含一个子子模块 FinderLastName: module App = type Model = {
(新手问题)。 在 Elmish.WPF 中,我有一个父模块 App,包含一个子子模块 FinderLastName: module App = type Model = {
我想将文件上传到我的 Fable-Elmish, end 以便我可以将其发送到服务器进行处理。但是,我找不到任何文档/示例来涵盖这一点。这是我的更新功能: let update msg model :
我需要使用带有 elmish 调度的 Fable-React 有状态组件。我不知道如何创建它。 我正在使用这个项目模板:https://github.com/fable-elmish/template
紧随my previous question我在“Elm in Action”(并尝试移植到 Fable-Elmish)中处理的示例具有来自自定义元素的自定义事件。在 html 文件中,我有以下内容:
我想在下拉列表中有一个不是 optional 之一的默认值(不是:DefaultValue“2”)。它应该类似于以下内容,但不适用于输入字段。 Input.Placeholder "Your name
我正在尝试读取寓言 elmish 中的 Browser.Blob 对象 - 我可以在 javascript 中看到它是这样完成的,但我不确定如何处理 FileReader onload 事件。 var
我正在尝试整合 Carbon Design System - React SDK在寓言/Elmish 应用程序中,看起来我必须创建 property type definitions (其中一些我只是
我想像这样添加一个图片标签 img [ Src "/AirPassengerData.png" ] 但是当我查看生成的网站时图像没有加载。 我正在使用 dotnet 核心项目模板fable-elmis
我尝试通过样式颜色设置颜色,但它仅在未禁用时更改颜色。使用或不使用 Fulma 是否有可能? Button.button [ Button.Disabled true
我尝试通过样式颜色设置颜色,但它仅在未禁用时更改颜色。使用或不使用 Fulma 是否有可能? Button.button [ Button.Disabled true
我可以按照 https://github.com/fable-elmish/react 设置 Elmish-React dotnet new -i "Fable.Template.Elmish.Rea
我正在尝试将 LiveCharts 示例转换为 Basic Line Chart与 Elmish.Wpf 一起使用 除了“YFormatter”之外,我对所有东西都有绑定(bind)。我应该使用哪种绑
我在主窗口中有一个复杂的 WPF Tab 控件,全部使用 C#,使用 .NET Framework。主窗口提供一致的主菜单和包含选项卡控件的内容控件。 选项卡控件的每个选项卡使用特定于每个用户控件的
我是 F# 的新手。我最近了解了 Elmish.wpf 和 MVU 设计。我正在使用的应用程序是 C# WPF,带有许多 WPF 用户控件、自定义控件和窗口。 Elmish.wpf 似乎将 View
我有一个 AspNetCore 后端 api(在 F# 和 Giraffe 中),它使用 AzureAD 身份验证和 Microsoft.AspNetCore.Authentication.Azure
我是一名优秀的程序员,十分优秀!