在ReactJs中使用异步路由器时添加空的<div>

时间:2019-02-15 13:59:18

标签: reactjs

我正在使用这个图书馆https://github.com/SimpleContacts/react-router-async-routes

我的路线:

<Route
            async
            path="/app"
            render={() =>
              Axios.get('/api/loggedin')
                .then(data => <MainApp />)
                .catch(err => <Redirect to={{ pathname: '/login', state: { from: this.props.location } }} />)
            }
          />

添加了一个空div:

enter image description here

如果我这样做:

  <Route path={`${match.url}app`} component={MainApp} />

未添加div。

是否有可能摆脱这个空的Div?或者,如何为该div添加一个类?

1 个答案:

答案 0 :(得分:1)

如果我没记错的话,我相信您的div来自您正在使用的library(第77行)。您的选择之一是向该库发出拉取请求,并用可能对您有用的内容替换div,或者对存储库进行派生并在没有div