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
| const puppeteer = require('puppeteer'); | |
| const googleSearch = async () => { | |
| const browser = await puppeteer.launch({ | |
| headless: false | |
| }); | |
| const page = await browser.newPage(); | |
| await page.viewport({ |
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
| const puppeteer = require('puppeteer'); | |
| const googleSearch = async () => { | |
| const browser = await puppeteer.launch({ | |
| headless: false | |
| }); | |
| const page = await browser.newPage(); | |
| await page.viewport({ |
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
| const puppeteer = require('puppeteer'); | |
| const googleSearch = async () => { | |
| const browser = await puppeteer.launch({ | |
| headless: false | |
| }); | |
| const page = await browser.newPage(); | |
| await page.viewport({ |
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
| const puppeteer = require('puppeteer'); | |
| const googleSearch = async () => { | |
| const browser = await puppeteer.launch({ | |
| headless: false | |
| }); | |
| } | |
| googleSearch(); |
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
| const puppeteer = require('puppeteer'); | |
| const googleSearch = async () => { | |
| } | |
| googleSearch(); |
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
| function useReducer(reducer, initState) { | |
| const [state, setState] = useState(initState); | |
| return [state, function () {}]; | |
| } |
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
| function useReducer (reducer, initState) { | |
| return [initState, function () {}] | |
| } |
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
| const initialState = { count: 0 }; | |
| function reducer(state, action) { | |
| switch (action.type) { | |
| case "increment": | |
| return { count: state.count + 1 }; | |
| case "decrement": | |
| return { count: state.count - 1 }; | |
| } | |
| } |
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
| function Counter() { | |
| const [state, dispatch] = useReducer(reducer, initialState); | |
| return ( | |
| <React.Fragment> | |
| Count: {state.count} | |
| <button onClick={() => dispatch({ type: "increment" })}>+</button> | |
| <button onClick={() => dispatch({ type: "decrement" })}>-</button> | |
| </React.Fragment> | |
| ) |
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 { render } from "react-dom"; | |
| import React, { useState, useCallback } from "react"; | |
| const initialState = { count: 0 }; | |
| function reducer(state, action) { | |
| switch (action.type) { | |
| case "increment": | |
| return { count: state.count + 1 }; | |
| case "decrement": |
NewerOlder