Comments (6)
Future version of Elmish will have a better naming for withReact
so I don't think adding these specials handlers is needed.
See https://github.com/elmish/react/pull/31/files
Also, if people are using Prop.Ref
to add a special behavior to their input
or textarea
your code will override this behavior and make it hard for them to understand the source of the bug.
from fable-react.
What bug do you mean? The user's Ref callback is still called. Plus this is a quick prototype to explore the idea, code can still be improved or warnings/hints added, etc.
I think this wouldn't add any more user difficulty than the status quo which has been accepted up to present.
Compare:
- Some number of users encounter common issue with cursor.
- Search web site/github for cursor issues.
- Learn about performance optimization affecting cursor in withReactBatched, and get alternatives.
vs:
- Presumably much smaller number of users encounter unknown edge case issue with Ref.
- Search web site/github for Ref issues.
- Learn about usability optimization using Ref internally in the input helper, and get alternatives.
I support the new names but they mostly improve understanding of the issue vs. avoiding the issue in the first place. Especially if templates/samples/etc. just switch over to withReactBatched
, which the obsolete tag for withReact
will recommend, then new user experience will be essentially the same but with improved names.
from fable-react.
Hum sorry I didn't saw the updateValueIfDifferent
and was thing you were loosing the user ref function.
I am not sure what to think about this but as long as it's provide as input'
and textarea'
(not made the default) I am ok for the change.
from fable-react.
I don't think there is much value adding them as non-default. Then they just become yet another workaround in a list of several workarounds already. I want to eliminate the need for workarounds for the majority of users, not add another one to their decision tree.
from fable-react.
This is great work @chadunit, thank you! Only thing is, as Maxime says, we're trying to introduce as less magic as possible in the bindings. We do it for example with the prop lists to have more idiomatic F# code, but this already confuses some users (see #132). When the function doesn't correspond 1:1 to React, I like to change the name to avoid this (example).
I'd wait a bit to see if the new names in Elmish.React help people be aware of the error. If it's still happening we can revisit this and implement the patches :)
from fable-react.
If changed names are the only option then perhaps this:
/// An input element with an automatic internal Ref prop to maintain cursor position when Value matches DOM state.
let inputRefCursor props =
createElement("input", props |> convertValueToRef |> keyValueList CaseRules.LowerFirst, [])
/// A textarea element with an automatic internal Ref prop to maintain cursor position when Value matches DOM state.
let textareaRefCursor props children =
createElement("textarea", props |> convertValueToRef |> keyValueList CaseRules.LowerFirst, children)
But anyway will go ahead and close for now, to await resurrection if revisted later.
from fable-react.
Related Issues (20)
- How to instantiate a custom React Component in Fable? HOT 2
- module.hot.addStatusHandler is not a function HOT 8
- React Server Components integration HOT 2
- Can't figure out how to wrap my view with a Higher Order Component HOT 4
- JsInterop helper for wrapping a higher order component HOT 2
- Can't reference React in Fable HOT 2
- Fable.ReactServer.cssProp very slow HOT 4
- Add Custom DU to DOMAttr HOT 1
- FunctionComponent.Lazy and SSR HOT 1
- Update samples to Fable 3
- ReactDOM.hydrate is no longer supported in React 18 HOT 17
- Can't update shared state passed with useContext? HOT 3
- Q: Use ReactElement import member for Storybook HOT 3
- Missing 'open' from Fable.React.Props? HOT 2
- Last Fable.React upgrade breaks my code HOT 7
- Publish source files from Fable.React.Types and Fable.ReactDom.Types to nuget HOT 5
- Fable.React version 8 depends on React.Dom gte 18 lt 19 according to femto
- Add Pointer Events HOT 3
- Why is useCallback not implemented? HOT 3
- How to obtain a component ref in a function component? HOT 5
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 fable-react.