Created
April 1, 2021 04:39
-
-
Save ram4git/bccb33f9083204f46f659e720ec8b8ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [routeLunchawalaMap, setRouteLunchwalaMap] = useState({}); | |
useEffect(() => { | |
const nRouteLunchawalaMap = {}; | |
db.collection('/routeAllocation').forEach((doc) => { | |
nRouteLunchawalaMap[doc.id] = [doc.lunchwalaId] | |
}); | |
setRouteLunchwalaMap(nRouteLunchawalaMap); | |
}) | |
{ | |
<routeId>: lunchwalaId | |
} | |
const lunchWalas = [ | |
{ | |
lunchwalaUserId: 'babad', | |
lunchwalaName: 'Ram' | |
}, | |
{ | |
lunchwalaUserId: 'sadfasd', | |
lunchwalaName: 'Sam' | |
}, | |
{ | |
lunchwalaUserId: 'baasdfbad', | |
lunchwalaName: 'Jam' | |
}, | |
]; | |
routes.map((item, index) => { | |
<> | |
<label>{item.name}</label> | |
<MultiSelect | |
hideTags={tags} | |
uniqueKey="lunchwalaUserId" | |
displayKey="lunchwalaName" | |
items={lunchWalas} | |
onSelectedItemsChange={(selectedItem) => { | |
const nRouteLunchawalaMap = {...routeLunchawalaMap}; | |
nRouteLunchawalaMap[item.id] = [selectedItem.lunchwalaId]; | |
setRouteLunchwalaMap(nRouteLunchawalaMap); | |
}} | |
selectedItem={routeLunchawalaMap[item.id]} | |
/> | |
</> | |
}) | |
const nRouteLunchawalaMap = | |
nRouteLunchawalaMap.c = 'Cat'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment