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

Unable to renderFromObject #4

Open
anthify opened this issue Nov 21, 2017 · 1 comment
Open

Unable to renderFromObject #4

anthify opened this issue Nov 21, 2017 · 1 comment

Comments

@anthify
Copy link

anthify commented Nov 21, 2017

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants