CatNoir
CatNoir
Explore posts from servers
CDCloudflare Developers
Created by CatNoir on 9/13/2024 in #general-help
Html error form validation error display
No description
9 replies
SSolidJS
Created by CatNoir on 8/11/2024 in #support
Override component events
TLDR: I used onContextMenu in a lot of components. Is there anyway to override and apply custom logic to that event without changing much code?
<div onContextMenu={...}></div>
<div onContextMenu={...}></div>
On Chrome Mobile, the onContextMenu event fires when you press and hold on an element. on Safari mobile, It doesn't work, so I have to apply custom logic. But currently I have a lot of components where I have already used onContextMenu. Is there anyway to apply custom logic to onContextMenu without changing much code?
3 replies
SSolidJS
Created by CatNoir on 7/31/2024 in #support
How can I use a custom hook with createMemo in many places?
I have created a hook like this:
// This is a hook
const useInMultiplePlaces =() => {

const complicated = createMemo(() => {
// something complicated
})

return {complicated}
}
// This is a hook
const useInMultiplePlaces =() => {

const complicated = createMemo(() => {
// something complicated
})

return {complicated}
}
I then use this hook in multiple active rendering components. the createMemo is probably ran multiple times everytime the useInMultiplePlaces hook is ran in those components. Is there anyway to like... have like a key for this memo, and reuse the same memo.. idk what im saying but i hope you understand my issue 😭
26 replies
SSolidJS
Created by CatNoir on 4/8/2024 in #support
Why does adding a new field duplicate the value?
No description
6 replies
SSolidJS
Created by CatNoir on 1/22/2024 in #support
Best pattern when using createStore to store large amount of data for a large app?
As the title says, what is the best pattern, is there an example on github or something you could show? In react + mobx, I know this pretty nice pattern which looks really clean and been using. Is there something like this pattern or something better for createStore?
import { makeAutoObservable } from 'mobx';

class Users {
users: Record<string, User> = {}
constructor() {
makeAutoObservable(this)
}
addUser(data: RawUser) {
const newUser = new User(data)
this.users[id] = newUser
}
}

class User {
id: string
username: string
firstName: string
lastName: string
constructor(data: RawUser) {
this.id = data.id
this.firstName = data.firstName
this.lastName = data.lastName
this.username = data.username
makeAutoObservable(this)
}
get fullName() {
return `${this.firstName} ${this.lastName}`
}
updateName(newUsername: string) {
this.username = newUsername;
}
}
import { makeAutoObservable } from 'mobx';

class Users {
users: Record<string, User> = {}
constructor() {
makeAutoObservable(this)
}
addUser(data: RawUser) {
const newUser = new User(data)
this.users[id] = newUser
}
}

class User {
id: string
username: string
firstName: string
lastName: string
constructor(data: RawUser) {
this.id = data.id
this.firstName = data.firstName
this.lastName = data.lastName
this.username = data.username
makeAutoObservable(this)
}
get fullName() {
return `${this.firstName} ${this.lastName}`
}
updateName(newUsername: string) {
this.username = newUsername;
}
}
4 replies
SSolidJS
Created by CatNoir on 1/26/2023 in #support
Unknown file extension ".ts" for rollup.config.ts
2 replies
SSolidJS
Created by CatNoir on 1/5/2023 in #support
How can I execute a function from parent?
How does ref work? I want to execute a function from parent, something like this:
// Parent
function Parent () {
let something;

return (
<Child something={something}/>
)
}

// Child
function Child(props) {
props.something = () => console.log("hello");

return <div>Hello</div>
}
// Parent
function Parent () {
let something;

return (
<Child something={something}/>
)
}

// Child
function Child(props) {
props.something = () => console.log("hello");

return <div>Hello</div>
}
Is something like this possible?
15 replies
SSolidJS
Created by CatNoir on 12/28/2022 in #support
How to change child child value?
https://stackblitz.com/edit/github-gp2gff?file=src%2FApp.tsx I'm trying to make some kind of parser, but I don't know how to fix this problem. Any help?
37 replies
SSolidJS
Created by CatNoir on 12/23/2022 in #support
How do i pass ref to child?
<div ref="how can i access this ref in ChildComponent?">
<ChildComponent/>
</div>
<div ref="how can i access this ref in ChildComponent?">
<ChildComponent/>
</div>
2 replies