Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having debugged a problem while using server rendering for two days I figured that the render functions in slate does not work nicely with react-prepare's component check. The reason is that when using the
render() {}
method it transpiles toand is therefore possible to determine the
render
property on the prototype. Whilerender = () =>
transpiles tothis.render = function () {};
and results in undefined render on the prototype. This makes_callClassCheck
raiseTypeError("Cannot call a class as a function");
, sincethis
is undefined due to no preparation of the component in react-prepare.Babel transpile examples are provided here
I've done some research and haven't really found much usage of the render as arrow functions, is this done by intention? My understanding was that arrow functions usually are used for helper methods and event handlers in components for implicit .bind(), but not for the
render
method itself.One could argue that this is something that should be accepted and improved in react-prepare, but I think that slate should use the most common practice.