MCPcopy Create free account
hub / github.com/bholmesdev/simplestack-store / FormComponent

Function FormComponent

src/integration.test.tsx:102–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 const passwordStore = formStore.select("password");
101
102 function FormComponent() {
103 const form = useStoreValue(formStore);
104 const isValid =
105 form.username.length > 0 &&
106 form.email.includes("@") &&
107 form.password.length >= 8 &&
108 form.password === form.confirmPassword;
109
110 return (
111 <div>
112 <input
113 data-testid="username"
114 value={form.username}
115 onChange={(e) => usernameStore.set(e.target.value)}
116 />
117 <input
118 data-testid="email"
119 value={form.email}
120 onChange={(e) => emailStore.set(e.target.value)}
121 />
122 <input
123 data-testid="password"
124 type="password"
125 value={form.password}
126 onChange={(e) => passwordStore.set(e.target.value)}
127 />
128 <button type="button" data-testid="submit" disabled={!isValid}>
129 Submit
130 </button>
131 </div>
132 );
133 }
134
135 render(<FormComponent />);
136

Callers

nothing calls this directly

Calls 1

useStoreValueFunction · 0.85

Tested by

no test coverage detected