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

Support for non-JSX render functions #6

Open
OliverJAsh opened this issue Dec 6, 2017 · 5 comments
Open

Support for non-JSX render functions #6

OliverJAsh opened this issue Dec 6, 2017 · 5 comments

Comments

@OliverJAsh
Copy link

Hi!

I just wondered if you had thought of also supporting non-JSX usages of React, where object/function identity is still a performance concern?

Thanks,
Oliver

@OliverJAsh
Copy link
Author

OliverJAsh commented Dec 6, 2017

We could also consider extending scope from objects/functions inside JSX to the whole render function, so this would error:

const MyComponent = () => {
  const toObject = { pathname: '/foo' };

  return <Link to={toObject}>foo</Link>;
};

@cvazac
Copy link
Owner

cvazac commented Dec 8, 2017

Yes! That was always part of the plan. Let me know if you are interested in contributing.

@OliverJAsh
Copy link
Author

@cvazac Is that yes to both ideas?

  1. Support non-JSX usages, e.g. React.createElement(MyComponent, { objectProp: {} })
  2. Support usages outside of virtual DOM but inside render functions

@cvazac
Copy link
Owner

cvazac commented Dec 8, 2017

I think both are important, but I'd prioritize 2 over 1. I had always planned to (attempt to) read more of the scope.

We report on:

  render() {
    return <Tag obj={{}} />
  }

But it's easily defeated with:

  render() {
    var o = {}
    return <Tag obj={o} />
  }

@OliverJAsh
Copy link
Author

@cvazac If it's OK with you, I'll open another issue to track 2, as I originally created this issue to track 1.

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