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
// App.js | |
import React, { useState, useEffect } from "react"; | |
import useWindowWidth from "./useWindowWidth"; | |
export default App = (props) => { | |
const [isMobile, setIsMobile] = useState(false); | |
const width = useWindowWidth(); | |
useEffect(() => { | |
setIsMobile(width <= 500); |
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
// App.js | |
import React, { useState, useEffect } from "react"; | |
import useWindowWidth from "./useWindowWidth"; | |
export default App = (props) => { | |
const [isMobile, setIsMobile] = useState(false); | |
const width = useWindowWidth(); | |
useEffect(() => { | |
setIsMobile(width <= 500); |
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
//useWindowWidth.js | |
import { useLayoutEffect, useState } from "react"; | |
export default function useWindowSize() { | |
const [width, setWidth] = useState(0); | |
useLayoutEffect(() => { | |
const updateWidth = () => setWidth(window.innerWidth); | |
window.addEventListener("resize", updateWidth); |
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 React from "react"; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: 0, | |
person: "TheAlfadur" | |
}; | |
} |
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 React, { useState, useEffect } from "react"; | |
export default App = (props) => { | |
const [person, setPerson] = useState("TheAlfadur"); | |
const [count, setCount] = useState(0); | |
useEffect(() => { | |
console.log(count); | |
}, [count]); |
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 React, { useState, useEffect } from "react"; | |
export default App = (props) => { | |
const [count, setCount] = useState(0); | |
useEffect(() => { | |
console.log(count); | |
return () => { | |
console.log(`Componente desmontado. ${count}`); | |
}; |
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 React, { useState } from "react"; | |
export default App = (props) => { | |
const p = { name: "Nome da pessoa", age: 24 }; | |
const [person, setPerson] = useState(p); | |
return <span>{`${person.name} - ${person.age}`}</span>; | |
}; |
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 React from "react"; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: 0 | |
}; | |
} |
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 React, { useState } from "react"; | |
export default App = (props) => { | |
const [count, setCount] = useState(0); | |
return <button onClick={() => setCount(count + 1)}>{count}</button>; | |
}; |
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 | |
namespace App\Jobs; | |
require_once __DIR__ . '/../../vendor/autoload.php'; | |
use Illuminate\Support\Facades\Log; | |
use App\Interfaces\ModelInterface; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Support\Facades\File; | |
use Illuminate\Queue\SerializesModels; |