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

Bug: HOC (memo/forwardRef) should throw for noop function #19548

Closed
ambar opened this issue Aug 6, 2020 · 1 comment · Fixed by #19550
Closed

Bug: HOC (memo/forwardRef) should throw for noop function #19548

ambar opened this issue Aug 6, 2020 · 1 comment · Fixed by #19550
Assignees
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@ambar
Copy link

ambar commented Aug 6, 2020

React version: v16

Steps To Reproduce

import React from "react";

export const Q = React.memo(() => {});
export const Z = React.forwardRef(() => {});

export default function App() {
  return (
    <>
      <Q />
      <Z />
    </>
  );
}

Link to code example: https://codesandbox.io/s/hoc-throw-null-xrhwg

The current behavior

No errors.

The expected behavior

Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

@ambar ambar added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Aug 6, 2020
@bvaughn bvaughn self-assigned this Aug 6, 2020
@bvaughn
Copy link
Contributor

bvaughn commented Aug 6, 2020

Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants