#Fetching data from client component using app router
1 messages · Page 1 of 1 (latest)
For instance getting selected filtered value from user interaction :
const selectChange = (event: any) => {
setStatus(event.target.value)
}
const options = Object.keys(TaskStatus)
return (
<div className="flex items-center justify-between border-b border-gray-200 pb-5">
<div className="text-lg text-gray-700 font-medium">
My tasks
</div>
<select onChange={selectChange} name="status" className="block focus:ring-indigo-500 focus:border-indigo-500 shadow-sm sm:text-sm border-gray-300 rounded-md">
{options.map((option: any, index: number) => (
<option key={index} value={option}>{option}</option>
))
}
</select>
</div>
)
Yeah, the filters and all that is client component, the filter state is in the url, and you fetch from that url.
https://twitter.com/asidorenko_/status/1680601155460554753 , something like this
Oh yeah good point
Nice, try that, if it helps your condition
Yes it's exactly helping me from what I need to do. Thank you 😉
But still have you find a way using fetch from client component ? I asume sometimes we have no choice
No idea ?
WDYM?
and create post in #1007476603422527558 if you have code related doubts, more people will see that