Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: make it compatible with memo and react compiler #202

Merged
merged 12 commits into from
Apr 29, 2024
Prev Previous commit
Next Next commit
remove memo
dai-shi committed Mar 2, 2024
commit 4f9d88774b958aa0a7c5048189abc352523b01e3
4 changes: 1 addition & 3 deletions examples/09_reactmemo/src/TodoItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { memo } from 'react-tracked';

import { useDispatch, TodoType } from './store';

@@ -9,8 +8,7 @@ type Props = {

let numRendered = 0;

// Use custom memo instead of React.memo
const TodoItem = memo(({ todo }: Props) => {
const TodoItem = React.memo(({ todo }: Props) => {
const dispatch = useDispatch();
return (
<li>
6 changes: 3 additions & 3 deletions examples/15_reactmemoref/src/TodoItem.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { forwardRef } from 'react';
import { memo } from 'react-tracked';

import { useDispatch, TodoType } from './store';

type Props = {
// FIXME why this complaints?
// eslint-disable-next-line react/no-unused-prop-types
todo: TodoType;
};

let numRendered = 0;

// Use custom memo instead of React.memo
const TodoItem = memo(
const TodoItem = React.memo(
forwardRef<HTMLInputElement, Props>(({ todo }, ref) => {
const dispatch = useDispatch();
return (
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { createContainer } from './createContainer';
export { createTrackedSelector } from './createTrackedSelector';
export { memo } from './memo';
export { getUntracked as getUntrackedObject } from 'proxy-compare';
34 changes: 0 additions & 34 deletions src/memo.ts

This file was deleted.