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
| import { useEffect, useState } from "react"; | |
| import BlogList from "./BlogList"; | |
| import useFetch from "./useFetch"; | |
| const Home = () => { | |
| const { error, isPending, data: blogs } = useFetch('http://localhost:8000/blogs') | |
| return ( | |
| <div className="home"> | |
| { error && <div>{ error }</div> } |
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
| import { useState } from "react"; | |
| function Cart() { | |
| const [cart, setCart] = useState({ | |
| items: [], | |
| total: 0, | |
| discount: null, | |
| isLoading: false, | |
| }); | |
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
| https://jsbin.com/qiyeriziyi/edit?html,css,output | |
| https://jsbin.com/jewegaseyo/edit?html,css,output |
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
| https://jsbin.com/cawipexoma/edit?html,css,output |
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
| .toast { | |
| --base-toast-color: hsl(226, 87%, 56%); | |
| color: oklch(from var(--toast-color) 25% c h); | |
| border: 2px solid var(--toast-color); | |
| background: oklch(from var(--toast-color) 90% calc(c / 2) h); | |
| box-shadow: 0 12px 12px -8px oklch(from var(--toast-color) l c h / 0.325); | |
| } | |
| .oklch { | |
| [data-toast="info"] { |
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
| /* | |
| https://jsbin.com/setohiqiwe/edit?html,css,output | |
| */ | |
| :root { | |
| --color: red; | |
| } | |
| .a, .b, .c { | |
| margin: 1rem; |
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
| <?php | |
| $regex1 = '/(\d+) \1/'; // Backreference | |
| $regex2 = '/(\d+) (?1)/'; // Subroutine | |
| 100 100 // ✅ only backreference | |
| 100 200 // ✅ both! | |
| // https://github.com/Hamz-a/php-regex-best-practices/blob/master/07%20Writing%20modular%20regexes.md |
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
| // useFormHandler.js | |
| import { ref } from 'vue' | |
| export function useFormHandler(initialData = {}) { | |
| const formData = ref({ ...initialData }) | |
| const errors = ref({}) | |
| const validate = () => { | |
| errors.value = {} | |
| Object.keys(formData.value).forEach(key => { | |
| if (!formData.value[key]) errors.value[key] = 'Required' |
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
| https://jsbin.com/qonusuciru/6/edit?html,css,output |
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
| _ |
NewerOlder