-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react/require-render-return shouldn't warn if render method is imported #563
Comments
Linters generally don't look at the contents of other files. Since |
@ljharb I guess render example wasn't really good here. export default function render() {
const {something} = this.state;
return (
<div>
<button onClick={this.functionInComponent}>{something}</button>
</div>
);
}; I am not saying linter should read other files, but it shouldn't produce the error here. My guess is ignoring such cases would be more than enough. |
@yamalight right but still, that function is an SFC. why not just use it inline in jsx as a component? |
(Also, the whole point of a react component is that logic and layout for the same component aren't separated) |
I have this obsession of splitting code into really small files :) |
The pattern debate aside, I think it should be ignored by the rule since we cannot check if a return statement is present in the render method in this case. |
I generally write components like this - one file for component, one for render method, e.g.:
Component.js
render.js
Currently this produces a warning, while it actually shouldn't.
The text was updated successfully, but these errors were encountered: