Skip to content

Instantly share code, notes, and snippets.

View pylnata's full-sized avatar
🏠
Working from home

Nataliia Pylypenko pylnata

🏠
Working from home
  • Wroclaw
View GitHub Profile
@pylnata
pylnata / preload.js
Last active September 26, 2019 04:51
import and preloading a bunch og images in react app
/* Page.js */
import React, { useEffect, useState } from "react";
const Page = props => {
const [images, setImages] = useState({});
const [imagesReadyCnt, setImagesReadyCnt] = useState(0); // counter of preloaded images
useEffect(() => {
const importedImages = {};
@pylnata
pylnata / RecipeItem.js
Last active April 3, 2023 02:59
Jest+Enzyme example unit test with SHALLOW for React component using useEffect and (useDispatch, useSelector) hooks
import React from "react";
export const Recipeitem = (props) => {
return (<div>
{props.title}
</div>)
}