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

implement derivedState + derivedParam #15

Merged
merged 1 commit into from
May 2, 2018
Merged

implement derivedState + derivedParam #15

merged 1 commit into from
May 2, 2018

Conversation

chentsulin
Copy link
Member

@Calvin-Lin @kidkcl @wtflink

加上了指定 state 跟 param 的地方,相容以下兩種回傳格式

const action = resolver(state, intent);
const { action, derivedState, derivedParam } = resolver(state, intent);

derivedState 會在執行 action 前 setState
derivedParam 會放到 action 執行時的第二個參數

src/index.js Outdated
if (arg && typeof arg !== 'object') {
warning(
false,
'should not provide not object type param with derivedParam. derivedParam will not be applied.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-object type?

@chentsulin chentsulin merged commit 9ad6d5b into master May 2, 2018
@chentsulin chentsulin deleted the derived branch May 2, 2018 04:01
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

Successfully merging this pull request may close these issues.

2 participants