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

Update getState to return an array, which could be extracted like react useState. #14

Closed
rabisnaqvi opened this issue May 24, 2023 · 4 comments · Fixed by #19
Closed
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rabisnaqvi
Copy link
Owner

Update getState to return an array, which could be extracted like react useState.
so it would be something like this:
const [count, onCountChange] = Astral.context.getState('count');

@Siar416
Copy link
Contributor

Siar416 commented May 24, 2023

Hey rabisnaqvi, I changed the getState function to how you mentioned above. How can I create a pull request?

@Siar416
Copy link
Contributor

Siar416 commented May 24, 2023

Are you able to give me write access? Or should I fork the repo, make the changes then submit a PR that way?

@rabisnaqvi
Copy link
Owner Author

Hey @Siar416 , thanks for contributing to this! you can create a branch from the issue, and then generate a PR to merge into the "release-candidate" branch. you can try that, if you face any permission issues then let me know I'll get that sorted.

@Siar416
Copy link
Contributor

Siar416 commented May 24, 2023 via email

@rabisnaqvi rabisnaqvi moved this from Todo to In Progress in Astral.js Main Development Board May 24, 2023
@rabisnaqvi rabisnaqvi linked a pull request May 24, 2023 that will close this issue
rabisnaqvi pushed a commit that referenced this issue May 25, 2023
…ct useState.#14

Updated unit tests to match the updated response from Astral.context.getState.
rabisnaqvi added a commit that referenced this issue May 25, 2023
…eact usestate (#21)

🤯 Update getState to return an array, which could be extracted like react useState.#14

* Updated the getState function to return an array similiar to how useState hook works

* Minor adjustment, instead of passing setState we are now passing a lister function instead.

* Update getState to return an array, which could be extracted like react useState.#14

* Updated unit tests to match the updated response from Astral.context.getState.

---------

Co-authored-by: Siar <[email protected]>
Co-authored-by: Rabis Naqvi <[email protected]>
@rabisnaqvi rabisnaqvi moved this from In Progress to Done in Astral.js Main Development Board May 25, 2023
@rabisnaqvi rabisnaqvi moved this from Done to Awaiting Release in Astral.js Main Development Board May 25, 2023
@github-project-automation github-project-automation bot moved this from Awaiting Release to Done in Astral.js Main Development Board May 26, 2023
@rabisnaqvi rabisnaqvi moved this from Done to Awaiting Release in Astral.js Main Development Board May 26, 2023
rabisnaqvi added a commit that referenced this issue May 26, 2023
- 🤯 Updated the getState function to return an array (tuple) similar to how React's useState hook works (#14 )
- ✅ Updated unit tests to match the updated response from Astral.context.getState.
- 📃 Fix broken hyperlink in the Getting Started section (#26 )
  - Replaced the broken hyperlink reference with the correct anchor link to the "Core Concepts" section.
  - Ensured that the anchor link matches the heading in the "Core Concepts" section.
- 🌀 Integrate Typescript or babel (#15 )
  - Converted all the source files to TypeScript namespaces.
  - Updated build process to parse the javascript files.
  - Replaced JSDOC with TypeDoc to generate documentation for the new typescript codebase.
  - Updated ESLINT configuration to be integrated with TypeScript.
  - Added some unit tests.
- 📃Break features and definitions into different lines in readme (#24 )
  - Updated readme.md to fix the line breaks and to reflect new updated features in Astral.context.getState and Astral.context.updateState.
- 📃Updated CONTRIBUTING.md
  - Updated CONTRIBUTING.md to ensure updated contributing processes.

---------


Co-authored-by: Rabis Naqvi <[email protected]>
Co-authored-by: Siar <[email protected]>
Co-authored-by: HARSH SRIVASTAV <[email protected]>
@rabisnaqvi rabisnaqvi moved this from Awaiting Release to Done in Astral.js Main Development Board May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Development

Successfully merging a pull request may close this issue.

2 participants