3 ms·
In React, forms are often built with this pattern: * Type/change events fire on the field (e.g. username) * Username updates the internal model (this.username
by mplewis 8y ago
In React, forms are often built with this pattern:
* Type/change events fire on the field (e.g. username)
* Username updates the internal model (this.username = 'karthikksv')
* The submit button fires an event so the parent page can act on the entire data model ({ username: 'karthikksv', password: 'fluffykittens' })
I'm concerned that this model won't work well using server-side React components on a network with high latency – each type event would have to round-trip to the server to update in the DOM.
- karthikksv 8y agoHigher latency connections will certainly have longer delays, but it's quite fast on a reasonable connection thanks to the persistent WebSocket, even if you're sending each letter that's being typed. We're using Purview in production at the company I work at, and we haven't had issues with input-related delays. If you don't need to send each letter, it's recommended to not do so; the submit event object includes all form data, so you can do one final validation at the end, similar to what you'd do with a normal web server.