This file contains 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, createContext, useContext, useEffect } from "react"; | |
import "./styles.css"; | |
const AuthContext = createContext({}); | |
const AuthProvider = ({ children }) => { | |
const [username, setUsername] = useState(""); | |
return ( | |
<AuthContext.Provider value={{ username, setUsername }}> | |
{children} |
This file contains 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 "./styles.css"; | |
import { useData } from "./useData"; | |
const useData = () => { | |
const [data, setData] = useState("This is the data"); | |
return { | |
data, | |
setData | |
}; |
This file contains 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 "./styles.css"; | |
import { useTodos } from "./hooks/useTodos"; | |
export default function App() { | |
const [error, setError] = useState(false); | |
const [todos, setStateTodos] = useState([]); | |
const updateTodo = (todo) => | |
setStateTodos([ |
NewerOlder