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:
Brandon Bayer
2023-06-13 17:36:42 -04:00
committed by GitHub
parent bebd998a55
commit a3f9709dde
7 changed files with 24 additions and 15 deletions

View File

@@ -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>