Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 226 KB

File metadata and controls

31 lines (20 loc) · 226 KB

useToggle medium #Composable Function

By webfansplz @webfansplz

Take the Challenge    Take the Challenge(Passed unit tests)    简体中文

For this challenge, we'll start by creating a composable function. Lets start with useToggle 👇:

<script setup lang='ts'>

/**
 * Implement a composable function that toggles the state
 * Make the function work correctly
*/
function useToggle() {

}

const [state, toggle] = useToggle(false)

</script>

<template>
  <p>State: {{ state ? 'ON' : 'OFF' }}</p>
  <p @click="toggle">
    Toggle state
  </p>
</template>

Back Share your Solutions Check out Solutions