Format React Components

I am trying to figure a work around to the way the Code Formatter formats React components. 

For example this code from my App.js:

render() {
return (
<div>
<Header currentUser={this.state.currentUser} />
<Switch>
<Route exact path='/' component={HomePage} />
<Route path='/shop' component={ShopPage} />
<Route path='/signin' component={SignIn} />
</Switch>
</div>
);
}

When I use the coee formattor is reconfigured to:

render() {
return (
<div>
<Header currentUser={this.state.currentUser} /> <Switch> <Route exact path='/' component={HomePage} /> <Route
path='/shop' component={ShopPage} /> <Route path='/signin' component={SignIn} /> </Switch>
</div>
);
}

Is there a setting that would help with this mess?

0

JSX tags are treated as 'inline' and thus aren't wrapped (https://youtrack.jetbrains.com/issue/WEB-37966)

Enabling Keep line breaks in text in Settings | Editor | Code Style | HTML | Other should preserve existing line breaks on reformatting

1

That worked thanks. I am really impressed how fast questions are responded.

0
Avatar
Permanently deleted user

You have saved me so much headache. I've been scouring for this all day—boy was it ANNOYING. Thank you!

0

请先登录再写评论。