Lesson 12 - use-email-selection composable

This commit is contained in:
Jeffrey Biles
2020-07-12 11:13:28 -07:00
parent a3102e72c3
commit 8f4f9d0328
3 changed files with 30 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
import { reactive } from 'vue';
let emails = reactive(new Set())
export const useEmailSelection = function(){
let toggle = function(email) {
if(emails.has(email)) {
emails.delete(email)
} else {
emails.add(email)
}
}
return {
emails,
toggle
}
}
export default useEmailSelection