Coder Social home page Coder Social logo

1.0 roadmap about dva HOT 28 CLOSED

dvajs avatar dvajs commented on May 13, 2024
1.0 roadmap

from dva.

Comments (28)

LeuisKen avatar LeuisKen commented on May 13, 2024 1

自己写了一个demo,对参与Quick StartTutorial的编写很有兴趣。

from dva.

Tinker404 avatar Tinker404 commented on May 13, 2024

目前写了写感觉非常棒, 期待文档, router的history的API配置有考虑进去吗?

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

history 现在就可配的,ref。如果要换成 browserHistory,可以这么做:

import dva from 'dva';
import { browserHistory } from 'dva/router';

const app = dva();
// 在 start 时传入 history
app.start(container, {
  history: browserHistory,
});

from dva.

Tinker404 avatar Tinker404 commented on May 13, 2024

这个设置browserHistory的确好用了,之前我是hashHistory并设置{queryKey: false}来去除随机生成的hash的,但是现在用DVA还是会有随机生成的hash,不知道有没有考虑过这类需求?

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@Tinker404 https://github.com/reactjs/react-router/blob/e75a70866fa738f8b2aa7db8a1cdc5f846dbfc0a/upgrade-guides/v2.0.0.md#using-custom-histories

from dva.

Tinker404 avatar Tinker404 commented on May 13, 2024

抱歉,可能我没表达清楚,我是按照router文档2.0的设置的,history的版本是2.0
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false }) app.start(container, { history: appHistory, });

这样设置后还是有hash

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@Tinker404 试过可以的,4bb6ab7

from dva.

Tinker404 avatar Tinker404 commented on May 13, 2024

查了一下发现是用了hashHistory这个API的关系,去掉就解决了,不知道有没有别的API能代替

subscriptions: [
    function (dispatch) {
      hashHistory.listen(location => {
        if (location.pathname === '/tabs') {
          dispatch({type: 'FETCH_DATA'});
        }
      });
    }
  ]

from dva.

popomore avatar popomore commented on May 13, 2024

model 是否可以改成面向对象的写法,也便于扩展,

// 字面量
const model = new app.Model({
  namespace,
  state,
  ..  
});

// 方法
const model = new app.Model()
.namespace('')
.state({});

// 也方便扩展
class CustomModel extends app.Model {};

views 层是否也可以管理起来,现在还需要手动写 connect,其实这一步可以默认做掉,没有任何 map 也不影响

class ConnectComponent extends react.Component {}

class MyComponent extends ConnectComponent {

  mapStateToProps(state) {
    return {
      prop: state.prop,
    }
  }
}

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@popomore

项目做下来,感觉用到继承的点并不多,真要扩展,推荐通过 high order function 的方式做。View 也是一样,React 社区倾向于用 pure function 的 component 形式。

connect 有考虑封装,和 reselect 结合,默认加缓存,保持高性能。但一个类似 mapStateToProps 的方法应该是没法省的。

from dva.

popomore avatar popomore commented on May 13, 2024

mapStateToProps 是没法省的。

业务实践可以,但社区方案应该更加可扩展。

from dva.

codering avatar codering commented on May 13, 2024

问下工程目录结构大致怎样的?以后的cli工具也应该遵循一定规范的吧。
看了https://github.com/sorrycc/dva/tree/master/examples/user-dashboard/src , 会按照这个结构来吗?

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@codering 是的,基本上就按这个目录了。

from dva.

fengmk2 avatar fengmk2 commented on May 13, 2024

dva 我建议不要放个人项目来做。

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@fengmk2 我建个 group 。

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

https://github.com/dvajs/dva

from dva.

evilbs avatar evilbs commented on May 13, 2024

能有一些线上的案例介绍吗

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@gzhappysky 为什么要 线上 的案例介绍? 你想了解哪方面的内容,最好详细点。

from dva.

evilbs avatar evilbs commented on May 13, 2024

@sorrycc 我想看一下用saga或者dva写出来的系统体验如何,学习一下!

from dva.

WhatAKitty avatar WhatAKitty commented on May 13, 2024

@sorrycc npmjs上有1.0的beta吗?发现0.16和1.0-beta的版本中subscriptions的类型不一致。

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@WhatAKitty 参考这份文档升级,1.0-beta 里一些 break change 。

from dva.

itiwll avatar itiwll commented on May 13, 2024

1.0 , HMR 支持了吗? 要怎么配置?

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

@itiwll 支持 components 和 routes 的,基于 babel 插件实现,指定 entry 文件。例子:https://github.com/dvajs/dva-cli/blob/master/boilerplates/app/webpack.config.js#L7-L14

from dva.

itiwll avatar itiwll commented on May 13, 2024

@sorrycc 可是[email protected] init 的新项目我不管修改什么文件都会刷新页面

from dva.

itiwll avatar itiwll commented on May 13, 2024

刚刚尝试在ubuntu下[email protected] init 的新项目 HRM 是可以的,windows 下要做什么才可以?

from dva.

sorrycc avatar sorrycc commented on May 13, 2024

抱歉,没有 windows 环境,定位不了问题。 hmr 是辅助功能,windows 就关闭此功能吧。。

from dva.

itiwll avatar itiwll commented on May 13, 2024
[HMR] connected
client.js:127 [HMR] bundle rebuilding
client.js:130 [HMR] bundle rebuilt in 320ms
process-update.js:27 [HMR] Checking for updates on the server...
process-update.js:81[HMR] The following modules couldn't be hot updated: (Full reload needed)
This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves. See http://webpack.github.io/docs/hot-module-replacement-with-webpack.html for more details.
process-update.js:89[HMR]  - ./src/routes/IndexPage.jsx
process-update.js:128[HMR] Reloading page
Navigated to http://localhost:8989/

from dva.

hbrls avatar hbrls commented on May 13, 2024

dva 课程开发 (面向内部全栈同学)

这个能放一部分出来吗?

from dva.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.