You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### How is it different from other form libraries?
255
+
256
+
React has many libraries which works on the form logic, but here are some concerns with these:
257
+
258
+
#### Code Complexity
259
+
If you’re using the redux-form then you should know the pain, for just a two field login form you’d to write the store logic.In RRF you can see that how simple is to deal with simple and complex forms.
260
+
261
+
`And one of the awesome thing is that you can just write your form controls logic anywhere in your application.`
262
+
263
+
#### Dependencies
264
+
Many libraries come with dependencies for e.g redux is required for redux-form, So what If I’m using another state management or not event using any.
265
+
According to Dan Abramov, form state is inherently ephemeral and local, so tracking it in Redux (or any kind of Flux library) is unnecessary.
266
+
RRF comes with `zero` dependency, So it’s totally up to you that how you want to save your form state if needed.
267
+
268
+
#### Performance
269
+
Now that’s a big problem with almost all libraries when you're dealing with large forms.
270
+
271
+
How RRF does solve performance issues ?
272
+
- It uses subscription to update the components so rather updating all the fields on every input changes, it only update the particular field for which the state change takes place.
273
+
- RRF has a nice option to define that when(blur, submit or change) to update your form's state by using the `updateOn` property.
274
+
275
+
#### Dynamic Changes
276
+
With the help of subscribers it's pretty easy to listen for a particular state changes and modify the controls accordingly.
277
+
278
+
279
+
### What are `value` and `status` changes subscribers?
280
+
281
+
RRF uses inbuilt `Subject`, A `Subject` is an object with the method next(v).To feed a new value to the Subject,RRF just calls the next(theValue), and it will be multicasted to the Observers registered to listen to the Subject.
282
+
So basically it provides three subjects for each AbstractControl `valueChanges`, `statusChanges` and `stateChanges` and additional two subjects for FormControl ( `onValueChanges`, `onBlurChanges`)
283
+
You can register an observer to a particular Subject to do some actions whenever some particular changes happen.
Checkout the [Basic usage guide](docs) for more details.
295
+
296
+
### How the Field components work?
297
+
298
+
Field components are subscribed to the state changes of a particular control which means that it’ll re-render the component only when it’s state changes disregarding of other field changes.You can also implement your custom wrappers by using the stateChanges `Subject`.
299
+
300
+
### How updateOn feature works?
301
+
302
+
Its an another performance booster in RRF, it just holds the computation needed to be made after every keystroke or value changes until you want to execute.It has three options `change`(default), `blur` and `submit`, you can define all of them at both field and record level.
303
+
304
+
252
305
# Code Sandboxes
253
306
Try out `react-reactive-forms` in these sandbox versions of the Examples.
0 commit comments