Skip to content

Instantly share code, notes, and snippets.

@satyendrakumarsingh
satyendrakumarsingh / pluralsight-auto-next-module.js
Last active December 15, 2022 14:01
Pluralsight Auto Continue Script - Updated Script for Pluralsight Auto Next Module
let autoNext = () => {
Array.from(document.querySelectorAll('button'))
.filter(b => b.textContent === 'Continue to next module')
.forEach(b => b.click());
};
setInterval(autoNext, 2500);
@bradwestfall
bradwestfall / HoC-vs-RenderProps-vs-Hooks.md
Last active April 14, 2024 15:54
An explanation of why Hooks are a nicer way to abstract re-useable state and functionality vs HoC's and Render Props

HoC (pattern) vs Render Props (pattern) vs Hooks (not pattern, a new API)

Someone was asking me about comparing the HoC and Render Props patterns (and their shortcomings) to hooks. I might leave this up as a public gist for others if it's helpful.


tldr;

Issues with HoC:

@romanonthego
romanonthego / ScrollToTopControlller.js
Last active July 13, 2022 10:52
Scroll to top with react hooks
import React, { useEffect } from 'react';
import { useRouter } from 'state';
// Component that attaches scroll to top hanler on router change
// renders nothing, just attaches side effects
export const ScrollToTopControlller = () => {
// this assumes that current router state is accessed via hook
// but it does not matter, pathname and search (or that ever) may come from props, context, etc.
const { pathname, search } = useRouter();