Giter Site home page Giter Site logo

learn-saga's Introduction

Feature: 实现功能

  • redux
  • redux-react
  • redux-saga
  • TypeScript

Test: 添加测试

  • component
  • utils function with unit-test
  • redux-saga
  • reducer
  • container

Spark: 调研

  • 移动端 px 尺寸自适应 解决方案
  • typescript
  • 手机网页的 debug, 利用 chrome 浏览器如何 debug

Spark: saga

Effect,将有副作用的代码全部放到 saga 里面

不断循环,直到{done:true},也就是说 caller 决定了,什么时候执行完,什么时候恢复执行,可以认为co.js就是一个函数自动执行器,effect就是一个普通对象,里面包含一些指令

saga 的测试,2种模式

以输入一个 action,异步输出另一个 action,这就是 saga 函数的输入输出点,这种模式不执行 reducer.

.withReducer(),通过 mock reducer的形式,对比前后 reducer 的情况,也就是会执行 reducer.

Tips

yarn eject

if you want to Custom Some Development with your config about create-react-app, pls use yarn eject.

git rebase

while you use git rebase to update your branch base on master branch, there maybe some conflict with master and your new branch , you need to do with the following operation

git rebase master <grbm> <on git:your branch>
# do something to fix the conflict files
git add . <ga .> # to add the confilg file, absolutely not <git commit>, with <git rebase --abort> also can recall before operation.
git rebase --continue <grbc>

command example

❯ grbm   
首先,回退头指针以便在其上重放您的工作...
应用:fix/conflict with repeat babel config
使用索引来重建一个(三方合并的)基础目录树...
M       package.json
回落到基础版本上打补丁及进行三方合并...
自动合并 package.json
冲突(内容):合并冲突于 package.json
error: 无法合并变更。
打补丁失败于 0001 fix/conflict with repeat babel config
提示:用 'git am --show-current-patch' 命令查看失败的补丁
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

git push -f

A very dangerout operation, This command can overwirte other person's commit.

Avoid to use this command!!! This command can only do in your branch, because this can overwrite other conflict commit, very dangerous!!!

The reason of this command's appearence is that your commit history is conflict with origin commit history, one need to be overwrited.

command example

❯ git push
To https://github.com/pengliheng/learn-saga
! [rejected]        fix/babelrc-conflict-package.json -> fix/babelrc-conflict-package.json (non-fast-forward)
error: 推送一些引用到 'https://github.com/pengliheng/learn-saga' 失败
提示:更新被拒绝,因为您当前分支的最新提交落后于其对应的远程分支。
提示:再次推送前,先与远程变更合并(如 'git pull ...')。详见
提示:'git push --help' 中的 'Note about fast-forwards' 小节。

change file without commit

absolutely, you can directly create a new branch, and then commit.

branch/commit name

branch name as:

  1. Feature/add-test

commit name as:

  1. Feature: add unit test
  2. Feature: add component test
  3. Feature: add reducer test
  4. Feature: add saga test

learn-saga's People

Contributors

plh97 avatar

Watchers

 avatar

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.