Bravi
Bravi
SSolidJS
Created by Bravi on 3/30/2023 in #support
How to use <Show> in ssr?
Hi everyone. I have this simple code:
export default function Home() {
const [error, setShowError] = createSignal(false);
const [_, { Form }] = createRouteAction(async (formData: FormData) => {
const username = formData.get('username');

if (username !== 'admin') {
setShowError(true);
}
});

return (
<div>
<Form>
<label>Username</label>
<input type="text" name="username" />
</Form>

<Show when={error()} keyed>
oops, you failed
</Show>
</div>
);
}
export default function Home() {
const [error, setShowError] = createSignal(false);
const [_, { Form }] = createRouteAction(async (formData: FormData) => {
const username = formData.get('username');

if (username !== 'admin') {
setShowError(true);
}
});

return (
<div>
<Form>
<label>Username</label>
<input type="text" name="username" />
</Form>

<Show when={error()} keyed>
oops, you failed
</Show>
</div>
);
}
Is it possible to somehow hide Show part from the downloaded js files? What I mean is, if I land on this page and have a look at the network tab, I can see that string inside one of the JS files.
27 replies
SSolidJS
Created by Bravi on 3/1/2023 in #support
ProtectedRoute with a redirect using @solidjs/router
Hi everyone. Is there a way to implement a ProtectedRoute, but with a redirect using @solidjs/router? All the examples I have seen, do something like user ? <Component /> : <Login />, but the url remains the same..
4 replies