react-ternary-be-gone 0.1.2 → 0.1.3
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.
- package/README.md +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,9 +42,9 @@ const items = ['Item 1', 'Item 2', 'Item 3'];
|
|
|
42
42
|
const value = 'b';
|
|
43
43
|
|
|
44
44
|
<Conditional switch={value}>
|
|
45
|
-
<Case when="a">A
|
|
46
|
-
<Case when="b">B
|
|
47
|
-
<Case default>
|
|
45
|
+
<Case when="a">A selected</Case>
|
|
46
|
+
<Case when="b">B selected</Case>
|
|
47
|
+
<Case default>None selected</Case>
|
|
48
48
|
</Conditional>
|
|
49
49
|
|
|
50
50
|
// If-ElseIf-Else rendering
|
|
@@ -52,13 +52,13 @@ const status = 'loading';
|
|
|
52
52
|
|
|
53
53
|
<Conditional>
|
|
54
54
|
<If when={status === 'loading'}>
|
|
55
|
-
|
|
55
|
+
<p>Loading...</p>
|
|
56
56
|
</If>
|
|
57
57
|
<ElseIf when={status === 'success'}>
|
|
58
|
-
|
|
58
|
+
<p>Success!</p>
|
|
59
59
|
</ElseIf>
|
|
60
60
|
<Else>
|
|
61
|
-
|
|
61
|
+
<p>Status unknown.</p>
|
|
62
62
|
</Else>
|
|
63
63
|
</Conditional>
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ const users = [{ id: 1, name: 'Alice', active: true }, { id: 2, name: 'Bob', act
|
|
|
70
70
|
{(user) => <p>{user.name}</p>}
|
|
71
71
|
</If>
|
|
72
72
|
<Else>
|
|
73
|
-
|
|
73
|
+
<p>No users found.</p>
|
|
74
74
|
</Else>
|
|
75
75
|
</Conditional>
|
|
76
76
|
```
|
|
@@ -147,9 +147,9 @@ Child component for use with `switch` prop. Use `when` for matching value, and `
|
|
|
147
147
|
|
|
148
148
|
```javascript
|
|
149
149
|
<Conditional switch={status}>
|
|
150
|
-
<Case when="loading">
|
|
151
|
-
<Case when="success">
|
|
152
|
-
<Case default>
|
|
150
|
+
<Case when="loading">Loading...</Case>
|
|
151
|
+
<Case when="success">Success!</Case>
|
|
152
|
+
<Case default>Status unknown.</Case>
|
|
153
153
|
</Conditional>
|
|
154
154
|
```
|
|
155
155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ternary-be-gone",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A React component designed to simplify conditional rendering and list iteration, providing a more readable and maintainable alternative to ternary operators and verbose conditional logic.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|