Skip to content

src cannot be undefined? #73

Description

@jonathan-meyer

In the pervious versions of this component the src property could be set to undefined which is handy in my case as I use this as a debug tool for seeing the internals of my React page. Could we add the undefined type to src? Or am I missing something on how to use this component correctly?

import ReactJson from '@microlink/react-json-view';
import { useEffect, useState } from 'react';

const Foo = () => {
  const [value, setValue] = useState<string>();

  useEffect(() => {
    setTimeout(() => {
      setValue('hi');
    }, 1000); // Simulate a delay
  }, []);

  return <ReactJson src={value} />;
};

export default Foo;

Image

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions