react-json-view icon indicating copy to clipboard operation
react-json-view copied to clipboard

React does not recognize the `inputRef` prop on a DOM element

Open Mustafa-Agha opened this issue 3 years ago • 11 comments

When I try to use react-json-view to render expandable row in a functional component in a table I get this error when I use onEdit method

React does not recognize the inputRef prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase inputref instead. If you accidentally passed it from a parent component, remove it from the DOM element

code

import { Table } from 'antd';

const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
  }
];

<Table
  rowKey="id"
  columns={columns}
  dataSource={data}
  expandable={{
    expandedRowRender: (record) => (
      <ExpandedRow record={record} />
    ),
  }}
/>;

//ExpandedRow child component

import { FC } from 'react';
import ReactJson from 'react-json-view';

interface IExpandedRow {
  record: any;
}

const ExpandedRow: FC<IExpandedRow> = ({ record, ...rest }: IExpandedRow) => {
  const onEdit = (data: any) => {
    console.log(data);
  };

  return (
    <>
      <ReactJson
        {...rest}
        onEdit={onEdit}
        src={record}
      />
    </>
  );
};

export default ExpandedRow;

I tried to create ref and pass it to ExpandedRow component but I got the same error, am I doing something wrong here ?

Mustafa-Agha avatar Jun 15 '21 06:06 Mustafa-Agha

Experiencing the same issue.

benpingilley avatar Jul 15 '21 20:07 benpingilley

+1

raptoria avatar Jul 20 '21 22:07 raptoria

Same here.

mddarmawan avatar Aug 04 '21 02:08 mddarmawan

+1

AaryanAdil avatar Aug 18 '21 22:08 AaryanAdil

having the same issue (using Next.js)

samsungapore avatar Aug 31 '21 14:08 samsungapore

duplicate of https://github.com/mac-s-g/react-json-view/issues/347

enricomad avatar Sep 27 '21 08:09 enricomad

+1

laolaolulu avatar Nov 23 '21 08:11 laolaolulu

+1 .... When I try rjv demo, there's no warning on json editing start. In my application, when I try te edit any element, I got this warning in the time I click to edit icon. I can't recognise the main difference in my vs. demo code, which causes this warning.. Thanks for any help

kulabros avatar Dec 07 '21 12:12 kulabros

@kulabros the issue is triggered by newer versions of react (compared to demo code), which the lib is not compatible with anymore. more details in #347

enricomad avatar Dec 07 '21 13:12 enricomad

upvote the fix by @enricomad https://github.com/mac-s-g/react-json-view/pull/374 :up:

dranitski avatar Dec 13 '21 10:12 dranitski

Same problem here until today :D Do I have to do anything to fix it?

RodrigosTiago avatar Apr 27 '22 02:04 RodrigosTiago