pronoob
pronoob
Explore posts from servers
SSolidJS
Created by pronoob on 3/3/2024 in #support
I have to fetch initial information in a component, how do I do it?
const App: Component = () => { const resp = await fetch(...); // show Home component after fetch is completed }
2 replies
SSolidJS
Created by pronoob on 3/3/2024 in #support
How do I "protect" routes? I am using @solidjs/router
Now that Outlet is not supported anymore? How do I implement a route guard for nested routes?
3 replies
SSolidJS
Created by pronoob on 11/10/2023 in #support
How do I implement authentication?
Hey there! I want to implement a very authentication, how would I go about implementing it? The user visits /register to create a new account. After they have created a new account, they must authentication by successfully logging in usingthe /login, at this point, they should be able to see the content of the /proc route
18 replies
DDeno
Created by pronoob on 9/4/2023 in #help
Is WASM generally faster than using Deno FFI?
...
17 replies
DDeno
Created by pronoob on 8/29/2023 in #help
What is the difference between JS Map and JS Object?
I know that Map is hash table implementation for JS, but how does it differ from an object? With regards to how Python dictionaries work, there seems to be no difference.
const x = new Map();
x.set("foo", "bar");
const x = new Map();
x.set("foo", "bar");
vs
const x = { foo: "bar" };
const x = { foo: "bar" };
4 replies
SSolidJS
Created by pronoob on 8/27/2023 in #support
How to save canvas state to backend and load it later?
How can I load the state and save it to the backend later?
4 replies
DDeno
Created by pronoob on 8/17/2023 in #help
Question about for loops
Why does the following code log numbers from 0 to 9 instead of 1 to 9? i is assigned as zero in the first expression, then it checks whether i is less than 10 and moves to the next expression which is i++, so it should increment the value of i to 1 instead and log it
for (let i = 0; i < 10; i++) {
console.log(i);
}
for (let i = 0; i < 10; i++) {
console.log(i);
}
27 replies
SSolidJS
Created by pronoob on 7/6/2023 in #support
How can I stop code from executing before?
I am using @solidjs/router for routing, here's the code:
<Router>
<Routes>
<Route path="/" component={Guard}>
<Route path="/" component={Root} />
</Route>

<Route path="/login" component={Login} />
</Routes>
</Router>
<Router>
<Routes>
<Route path="/" component={Guard}>
<Route path="/" component={Root} />
</Route>

<Route path="/login" component={Login} />
</Routes>
</Router>
The Guard component checks for authentication (whether key is not in localStorage) in createEffect and navigates based on the result. The Root component is a protected component and only authenticated user can access it (localStorage contains the key item). The Root component looks something like this:
const Root: Component = () => {
const ws = new WebSocket("...");
ws.onmessage = e => {
console.log(e);
};

return <h1>Root</h1>;
};
const Root: Component = () => {
const ws = new WebSocket("...");
ws.onmessage = e => {
console.log(e);
};

return <h1>Root</h1>;
};
However, the WebSocket is connected before the Guard component validates and navigates the user.
5 replies
SSolidJS
Created by pronoob on 7/3/2023 in #support
How to have a default layout for all routes?
I am using @solidjs/router and I want to have a default layout to have a default background color. How do I do that?
46 replies
SSolidJS
Created by pronoob on 6/26/2023 in #support
How to define reference for a component?
How can I define ref for a custom component with TypeScript?
18 replies