Giter Site home page Giter Site logo

Comments (5)

bindoon avatar bindoon commented on August 20, 2024

It seems good. welcome PR.

from next.

vicerwang avatar vicerwang commented on August 20, 2024

A great idea!But we also should notice that using Input in Form, if we offer another onChange property such as onFinalValueChange or onCompositedVauleChange, in situation of this issue it may be a bit tricky as Form will only use onChange property. So is it better to offer an API such as composition to determine when to trigger an change event,if it is true,we will receive the real time value in onChange callback,otherwise we will receive the final value,it's default value is true as compatibility.

from next.

ileenhow avatar ileenhow commented on August 20, 2024

@vicerwang I have thought about implementing it like you said. But if we depend on another boolean prop composition to call onChange or not, we have to add some logic in onChange, and when using Input as a controlled component, the value will not be updated as normal, you can read this article for detail, or loot at the demo I created.

Certainly, using Input in Form is a common case, but I haven't figure out how to archive this without modifying onChange.

from next.

vicerwang avatar vicerwang commented on August 20, 2024

@ileenhow Thank you for your reply, it seems that my idea is not working due to the limitations of the react. In addition, if we use Input in the Form, the onChange is actually enough, because whether you click the submit button or enter the return, it will trigger onCompositionEnd first, so we always get the final value of the input. Now i think your solution will work well.

from next.

bindoon avatar bindoon commented on August 20, 2024

Input can accept the original props to input element.

from next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.