Skip to content

Instantly share code, notes, and snippets.

@dthtien
dthtien / SomeComponent.js
Last active April 14, 2022 20:22
React Redux code splitting
//views/SomeComponent/index.js
import React from "react";
import { connect } from "react-redux";
import { compose } from "redux";
import reducer, { reducerName as key } from "./reducer";
// import reducerRegistry from "utils/reducerRegistry";
import reducerInjector from "utils/reducerInjector";
function SomeComponent() {
const classes = useStyles();
@herr-vogel
herr-vogel / material-ui-next-js-button.js
Last active November 16, 2021 10:14
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>
@Yimiprod
Yimiprod / difference.js
Last active June 20, 2024 08:26
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {