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
export const JSONContentMock: JSONContent = { | |
doc: { | |
type: 'doc', | |
content: [ | |
{ | |
type: 'heading', | |
attrs: { level: 1 }, | |
content: [{ type: 'text', text: 'Title' }], | |
}, | |
{ |
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
const students = [ | |
{ name: 'Alice', age: 20, grade: 4.5 }, | |
{ name: 'Bob', age: 21, grade: 3.9 }, | |
{ name: 'Charlie', age: 19, grade: 4.8 }, | |
]; | |
const calculateAverageGrade = (studentArgument) => { | |
let result = 0; | |
// сумма всех баллов (версия 1) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1"/> | |
<meta name="theme-color" content="#000000"/> | |
<meta property="title" | |
content="React HOC, Component Wrapping and Render Props page | by Artem Diashkin | Jan, 2022 | Netlify"/> | |
<meta name="description" content="This page is an example of implementing Higher-Order Component pattern"/> |
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 { ApolloClient, gql, useApolloClient } from '@apollo/client'; | |
import Uppy from '@uppy/core'; | |
// https://github.com/uuidjs/uuid#getrandomvalues-not-supported | |
import 'react-native-get-random-values'; | |
import { v4 as uuidv4 } from 'uuid'; | |
import { translateScalar } from '@landr/mfe/src/utils/translateScalar'; | |
import { useMemo } from 'react'; | |
import { FileUploaderProps } from '@landr/mfe'; | |
import { useFileUploader } from '@landr/mfe/src/customHooks/useFileUploader'; | |
import * as DocumentPicker from 'expo-document-picker'; |
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 React, { useEffect, useState } from 'react'; | |
import logo from './logo.svg'; | |
import { ChromeMessage, Sender } from "./types"; | |
import './App.css'; | |
export const App = () => { | |
const [url, setUrl] = useState<string>(''); | |
const [responseFromContent, setResponseFromContent] = useState<string>(''); |
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 { ChromeMessage, Sender } from "../types"; | |
const messagesFromReactAppListener = (message: ChromeMessage, sender, response) => { | |
console.log('[content.js]. Message received', { | |
message, | |
sender, | |
}) | |
if ( | |
sender.id === chrome.runtime.id && |
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 React, { useEffect, useState } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
export const App = () => { | |
const [url, setUrl] = useState<string>(''); | |
/** | |
* Get current URL | |
*/ |
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
expect(result.current.isTrue).toBe(false); | |
- await waitForNextUpdate(); | |
+ await waitForNextUpdate({ | |
+ timeout: 2500, | |
+ }); | |
expect(result.current.isTrue).toBe(true); | |
}); |
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
useEffect(() => { | |
const id = setTimeout(() => { | |
setIsTrue(true); | |
- }, 1000); | |
+ }, 2000); | |
return () => { | |
clearTimeout(id); |
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 { renderHook, act } from '@testing-library/react-hooks'; | |
import { useSimplestHook } from './1.simplest-hook'; | |
it('should set to true', () => { | |
const { result } = renderHook(() => useSimplestHook()); | |
expect(result.current.isTrue).toBe(false); | |
act(() => { | |
result.current.toggle(); |
NewerOlder