Skip to content

Commit

Permalink
Rephrase the AutoField algorithm docs (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
Monteth authored Mar 8, 2024
1 parent eed59c6 commit 555cb98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/uth-autofield-algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ const AutoField = createAutoField(props => {

## Overriding `AutoField`

To make it possible, all `AutoFields` created with the `createAutoField` are configurable. To adjust the components, use the React context available in `AutoField.componentDetectorContext`. You can use it as often as needed - in most apps once will be enough. Example:
If you want to alter the default behavior of `AutoField` and render a different component based on the props, you can do it using the React context available in `AutoField.componentDetectorContext`. You can use it as often as needed - once will be enough in most apps. Example:

```tsx
<AutoField.componentDetectorContext.Provider value={(props, uniforms) => /* ... */}>
<Application />
</AutoField.componentDetectorContext.Provider>
```

If you want to add an exception and then fallback to the existing algorithm, use `AutoField.defaultComponentDetector`. Example:
If you want to change the detector only partially, i.e., to render one additional field, and in other cases, use the default algorithm as a fallback, return `AutoField.defaultComponentDetector`. Example:

```tsx
<AutoField.componentDetectorContext.Provider
Expand Down

0 comments on commit 555cb98

Please sign in to comment.