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

React showGithub #18

Open
xiaotiandada opened this issue Jan 19, 2021 · 0 comments
Open

React showGithub #18

xiaotiandada opened this issue Jan 19, 2021 · 0 comments

Comments

@xiaotiandada
Copy link
Owner

xiaotiandada commented Jan 19, 2021

技术栈

// ...
"@antv/data-set": "^0.10.1",
"antd": "^3.11.6",
"axios": "^0.18.0",
"bizcharts": "^3.4.3",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^6.0.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.2",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.7",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0"
// ...

路由

<Router>
  <Switch>
    <Route path="/" exact component={IndexDom} />
    <Route path="/list" exact component={ListDom} />
    <Route path="/about/" exact component={DetailDom} />
    <Redirect from="*" to="/" />
  </Switch>
</Router>

Redux

// redux
import { connect } from "react-redux";
import action from "../../store/action/index";

// ...
const { xxx } = this.props;
// ...
const mapStateToProps = state => ({
  ...state
});
export default connect(
  mapStateToProps,
  action
)(IndexDom);

如果没有数据 变会自动跳转到首页。

export const isEmptyArray = arr => Array.isArray(arr) && arr.length === 0;

if (isEmptyArray(userList)) this.props.history.push("/");
@xiaotiandada xiaotiandada changed the title Echarts系列之复制粘贴大法 react-showGithub小项目 Oct 4, 2022
@xiaotiandada xiaotiandada changed the title react-showGithub小项目 React showGithub Oct 4, 2022
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

1 participant