Next.js Discord

Discord Forum

getting last index data on declared useState variable

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
I have a list of data where on each data user can select any data , when user select the specific data it will run an API for that particular data but it always shows data of the last index
here is my code

const [openViewDeliverables, setViewDeliverables] = useState(false)
const [showAllMilestoneDeliverables, setShowAllMilestoneDeliverables] = useState<ShowAllMilestonesDeliverablesModel>()




on the openViewDeliverables data is getting saved for the last index only

1 Reply

Barbary LionOP
anyone can help ?