Comments (10)
I am pretty sure keyValueList
is not just for DU's and I think will behave pretty much the same as createObj
. When you say "incorrect use", do you mean it is generating something in a wrong way?
from feliz.
Nope, I just figured it was incorrect since it goes against the function's documentation, which explicitly says "Create a literal JS object from a collection of union constructors", and since there's another function createObj
which is #seq<string, obj> -> obj
which is exactly what we want.
Also AFAIK having casing rules makes no sense since we already have names as strings, not as union case names.
from feliz.
I see, nowadays keyValueList
is my swiss army knife when doing interop as it has evolved from just working with DU's and my guess is that the docs are outdated but createObj should be just fine. (Even though I think of createObj
of something that works in compile-time to get a nice object literal but it should work with lists created dynamically as well AFAIK)
Alright, will look into it soon
from feliz.
keyValueList
has been created for working with DUs in the fist place indeed, but at compilation, Fable replaces the DUs name by the string representation.
And so it's become similar to what we do for Feliz. For example, you are probably already using the string representation version if you ever used Style
in one of your application.
By using keyValueList
, we also help keep the bundle size-tiny because we don't have to re-implement the same function in our code. So if the user uses Fable.React
in his application or any library who use keyValueList
then adding Feliz don't duplicate the code.
from feliz.
By using
keyValueList
, we also help keep the bundle size-tiny because we don't have to re-implement the same function in our code. So if the user usesFable.React
in his application or any library who usekeyValueList
then adding Feliz don't duplicate the code.
Wouldn't that be the case for createObj
too?
from feliz.
I not sure if the signature of createObj
is the same or not but perhaps yes.
from feliz.
The signature isn't the same. For example, createObj
doesn't take any case formatting rules as input, just seq<string, obj>
, because it uses the strings as names as-is (of course).
I'm not sure how the signature is relevant though; my point was that createObj
is built-in (just like keyValueList
) and that using createObj
instead of keyValueList
won't add overhead. (I may be wrong.)
from feliz.
By signature, I wanted to mean the list
argument.
createObj
add a bit smaller overhead than keyValueList
because it doesn't check the case
formatting args.
from feliz.
So createObj
is the optimal choice in Feliz?
from feliz.
So createObj is the optimal choice in Feliz?
Probably but it needs testing to make sure it does what it should do like keyValueList
does, PR please 🙏?
from feliz.
Related Issues (20)
- Q: interesting
- add vitest to template
- useElmish vs useReducer HOT 4
- Feedback on missing docs for newcomers HOT 1
- ReactComponentAttribute for props list HOT 2
- Q: Documentation on breaking changes in 2.6? [WAS Updating Feliz.UseListener to Feliz 2.6.0] HOT 4
- CSS overflow-anchor property HOT 1
- Error with Feliz 2.7 HOT 2
- Making UseElmish's dispatch function stable
- Feliz.Markdown escapeHtml doesn't seem to work HOT 1
- UseElmish: Failed to resolve import "use-sync-external-store/shim" HOT 3
- `react-markdown` removes the `escapeHtml` property HOT 1
- Clarification and Potential Improvement on PR #480 useEffectOnce behavior HOT 5
- Expanding Feliz.Rechart HOT 3
- Component created with a forwardRef that has generic type parameters loses state HOT 2
- "Directory import use-sync-external-store\shim is not supported" in UseElmish.fs.js HOT 2
- Use with Elmish documentation is lacking integration HOT 2
- Enhance Handling of F# Record Types as Props in ReactComponent Attribute HOT 4
- Explore if Feliz.CompilerPlugin can support POJO made using `[<ParamObject>]`
- prop.pattern produces invalid html HOT 4
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 feliz.