Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Feature: Support multiple actions - #20

Open
r17x wants to merge 6 commits into
nextfrom
feature/support-multiple-actions-init
Open

Feature: Support multiple actions#20
r17x wants to merge 6 commits into
nextfrom
feature/support-multiple-actions-init

Conversation

@r17x

@r17x r17x commented Aug 11, 2019

Copy link
Copy Markdown
Member

What this change?

/// init actions
const actions = [function(state,actions,...), function(state,actions,...)]

/// 
<Provider actions={actions}>
  {...app component}
</Provider>

// In Component where implemented or use this action in actions init
const [state, actions] = useGlobalState()
actions.funcName(payload)

@r17x
r17x requested a review from faultables August 11, 2019 18:22
@faultables

Copy link
Copy Markdown
Member

why should we use this approach?

@faultables

faultables commented Aug 12, 2019

Copy link
Copy Markdown
Member

Can you please elaborate more related with this changes? For what I understand, this approach is to reducing ceremony in dispatching some action. So, this action payload:

{
  type: 'LOGIN',
  payload: {
    username: 'fariz',
    password: 's3ndnud3s'
  }
}

Is simplified (or replaced with) to this:

action.login({
  payload: {
    username: 'fariz',
    password: 's3ndnud3s'
  }
})

Or even this:

action.login({
  username: 'fariz',
  password: 's3ndnud3s'
})

Let me know if I'm wrong

@faultables

Copy link
Copy Markdown
Member

Btw my comment was based on this test file.

  const ChangeTest = () => {
-    const [, dispatch] = useGlobalState()
+    const [, actions] = useGlobalState()

...

- dispatch({
+ actions.changeTest({
     type: 'TEST'
  }) 

@faultables faultables closed this Apr 3, 2021
@faultables faultables reopened this Apr 3, 2021
@faultables

Copy link
Copy Markdown
Member

Closed by accident, sorry

@r17x

r17x commented Apr 5, 2021

Copy link
Copy Markdown
Member Author

I think we can close this project cause in react have so many alternative and we not maintain this project, wdyt ? @faultable

@faultables

Copy link
Copy Markdown
Member

do your best, bro

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants