mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-06 04:19:43 +00:00
fix: several type and build errors and fix example type inference (#399)
* fix few type errors and fix example * couple fixes * fix babel
This commit is contained in:
@@ -181,12 +181,16 @@ export default function App() {
|
||||
/>
|
||||
</div> */}
|
||||
<form.Subscribe
|
||||
selector={(state) => [state.canSubmit, state.isSubmitting]}
|
||||
children={([canSubmit, isSubmitting]) => (
|
||||
<button type="submit" disabled={!canSubmit}>
|
||||
{isSubmitting ? "..." : "Submit"}
|
||||
</button>
|
||||
)}
|
||||
{...{
|
||||
// TS bug - inference isn't working with props, so use object
|
||||
selector: (state) =>
|
||||
[state.canSubmit, state.isSubmitting] as const,
|
||||
children: ([canSubmit, isSubmitting]) => (
|
||||
<button type="submit" disabled={!canSubmit}>
|
||||
{isSubmitting ? "..." : "Submit"}
|
||||
</button>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</form>
|
||||
</form.Provider>
|
||||
|
||||
Reference in New Issue
Block a user