Skip to content

How to persist value using abstracted updateWithProp functions #371

Closed Locked Answered by jamesrweb
hanhanxue asked this question in Q&A
Discussion options

You must be logged in to vote

I refactored your solution a little:

"use client";

import { P5CanvasInstance, SketchProps } from "@p5-wrapper/react";
import { NextReactP5Wrapper } from "@p5-wrapper/next";
import React, { useState, useMemo } from "react";
import UISidebar from "@/components/UI/UISidebar/UISidebar";
import UISlider from "@/components/UI/UISlider";
import { Hct } from "@material/material-color-utilities";

type SwatchDimensions = {
  width: number;
  height: number;
};

type IProps = SketchProps & {
  hue: number;
  steps: number;
  chroma: number;
  swatchDimensions: SwatchDimensions;
};

type TonalPaletteConfig = {
  p5: P5CanvasInstance<IProps>;
  steps: number;
  hue: number;
  chroma: number;
  swatc…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@hanhanxue
Comment options

@jamesrweb
Comment options

@hanhanxue
Comment options

@jamesrweb
Comment options

Answer selected by hanhanxue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants