MainframeOS / react-json-renderer

MIT License
37 stars 3 forks source link

Unable to renderFromObject #4

Open anthify opened 7 years ago

anthify commented 7 years ago

Hello,

I've been playing about with this tool and think I may be either misunderstanding it or have found a bug.

In the example below I've converted a component to an object and then an object to a component but it doesn't seem to work.

import React, { Component } from 'react';
import { convertToObject, renderFromObject } from 'react-json-renderer'

const ToBeConvereted = () => <span>Hello</span>;
const toJson = convertToObject(<ToBeConverted />);
const ToObject = renderFromObject(toJson);

class App extends Component {
  render() {
    return (
      <div>
        <ToObject />
      </div>
    );
  }
}

export default App;
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `App`.

I'm sure you're thinking "dafuq?", but I thought renderFromObject would return a renderable component, and now I'm kid of confused as to what it is supposed to do.

Thanks!

Anth

PaulLeCam commented 6 years ago

Hi, sorry for the late reply, I haven't been focusing on this lib since it got implemented in our project.

I seems there is a typo with ToBeConvereted between the component declaration and usage that would explain the error.