Replies: 1 comment
-
Hello @santialbo, I would definitely advise against option number 1, because creating components on-the-fly is discouraged as it can lead to unwanted side effects. Option number 2 would be the recommended way to handle this when using custom components. Option number 3 is possible, but you could have problems with types inside a TypeScript environment. Also the prop would be available under There exists another option which does not need a custom component: the const user = ...;
const noOptionsMessage = useCallback(({ inputValue }) => `message for ${user}`, [user]);
<Select
noOptionsMessage={noOptionsMessage}
/> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's the recommended way of passing some data to custom components.
Let's say I want to change the component
NoOptionsMessage
for example and show something that depends on the user of my app.What's the best way of passing this user so my custom
NoOptionsMessage
can read it?I can think of several options:
Out of all of them I like number 3 the most, but I'm not sure it's currently possible. Number 2 feels the most correct but it's very verbose, and number 1 doesn't feel quite right. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions