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
wants to merge 6 commits into
base: next
Choose a base branch
from

Conversation

r17x
Copy link
Member

@r17x r17x commented Aug 11, 2019

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
Member

why should we use this approach?

@faultables
Copy link
Member

faultables commented Aug 12, 2019

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
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
Member

Closed by accident, sorry

@r17x
Copy link
Member Author

r17x commented Apr 5, 2021

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
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