react-sync-ui 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +12 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # react-sync-ui
2
2
 
3
- `react-sync-ui` enable to do the sequential synchronous workflow with usage of React Components.
3
+ `react-sync-ui` promisify your React Components and make your UI awaitable.
4
4
 
5
5
  ## usage example
6
6
 
@@ -14,7 +14,7 @@
14
14
  await syncAlert("Invalid password, keep trying");
15
15
  }
16
16
 
17
- await syncAlert(`Congratulation Mr. ${name}, you are logged in`);
17
+ await syncAlert(`Congratulation ${name}, you are logged in`);
18
18
  }}
19
19
  >
20
20
  Login
@@ -23,8 +23,8 @@
23
23
 
24
24
  ![Sync UI preview](./docs/sync-ui-preview.gif)
25
25
 
26
- Library provides simple `makeSyncUI<InputData, ResolveValue>` function which can transform your declarative React Components
27
- into the promisified callable functions.
26
+ `react-sync-ui` provides function `makeSyncUI<InputData, ResolveValue>` which transform your declarative React Components
27
+ into the promisified awaitable functions.
28
28
 
29
29
  ```tsx
30
30
  // defining of your custom react-sync-ui component
@@ -38,23 +38,25 @@ export const syncAlert = makeSyncUI<string, void>((props) => (
38
38
  );
39
39
  ```
40
40
 
41
- ## what problem is `react-sync-ui` solving?
41
+ ## what is `react-sync-ui` solving?
42
42
 
43
43
  For a long time, I did not like that React's functional way of declarative UI forced you to write nice UI code, but with ugly distributed business logic.
44
44
  When you have a complex business use case which is a composition of asynchronous actions like HTTP requests together with user interactions,
45
- your business logic code is distributed over many async React handlers and it's really hard to understand the sequence of operations and what is going on.
45
+ your business logic code is distributed over many async React handlers and it's really hard to understand the sequence of business logic.
46
46
 
47
- People very often solve this problem by dependencies in the `useEffect(..., [dependency])` which transfer react logic to the event-driven architecture.
48
- When you change the variable value, the different components will register the dependency change inside of `useEffect`, and some other code is called.
49
- With this event-driven programming, your code complexity is at least 1000 times more complex, and your newcomers who see the code have no idea what the business workflow is.
47
+ People very often solve this problem by dependencies in the `useEffect(..., [dependency])` which transfer React logic to the event-driven architecture.
48
+ When you change the dependency variable value, the different components will register the dependency change, and `useEffect` will be re-called.
49
+ With this event-driven programming style, your code complexity is 1000 times more complex, and your newcomer programmes who see the code have the business workflow is.
50
50
 
51
51
  A nice solution for this problem is to wrap your declarative React components into Promise wrappers which split your UIs into many
52
52
  smaller functions that can be simply composed together inside of your Javascript function and you'll get very complex business logic in just a few lines of code.
53
53
 
54
- Thanks to `react-sync-ui` you may implement just your custom UI and don't have to care about the implementation detail of promise wrapping.
54
+ Thanks to `react-sync-ui` you can simply promisify your React Components UI and make your UI awaitable.
55
55
 
56
56
  And that's why `react-sync-ui` was created. ❤
57
57
 
58
+ PS: i took inspiration from awesome functions: `window.alert`, `window.confirm` and `window.prompt`.
59
+
58
60
  ## Installation
59
61
 
60
62
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-sync-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "repository": "https://github.com/Svehla/react-sync-ui",
5
5
  "license": "MIT",
6
6
  "author": "Jakub Švehla",