You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 2, 2024. It is now read-only.
-**Growing list of semantic helper components and hocs**
42
+
-**Growing list of semantic helper components and hocs!**
43
43
-**[List](https://csvenke.github.io/react-semantic-render/#!/List)**: Renders content from an array of data.
44
44
-**[Switch](https://csvenke.github.io/react-semantic-render/#!/Switch)**: Renders content from first case that matches, else default if it exists.
45
45
-**[Show](https://csvenke.github.io/react-semantic-render/#!/Show)**: Renders content when specified condition is true.
@@ -71,7 +71,7 @@ Render button when condition is true
71
71
72
72
```jsx
73
73
importReactfrom'react';
74
-
importShowfrom'react-semantic-render/Show';
74
+
import{ Show} from'react-semantic-render';
75
75
76
76
constApp= ({ showButton }) => (
77
77
<Show when={showButton}>
@@ -84,7 +84,7 @@ Render list of names
84
84
85
85
```jsx
86
86
importReactfrom'react';
87
-
importListfrom'react-semantic-render/List';
87
+
import{ List} from'react-semantic-render';
88
88
89
89
constApp= () => (
90
90
<ul>
@@ -99,77 +99,61 @@ const App = () => (
99
99
);
100
100
```
101
101
102
-
Render message when condition is true, else render something else
102
+
Render message when condition is true, else render button
103
103
104
104
```jsx
105
105
importReactfrom'react';
106
-
importSwitchfrom'react-semantic-render/Switch';
106
+
import{ Switch} from'react-semantic-render';
107
107
108
108
constApp= ({ showMessage }) => (
109
109
<Switch value>
110
110
<Switch.Case value={showMessage}>
111
111
<span>Render me!</span>
112
112
</Switch.Case>
113
113
<Switch.Default>
114
-
<span>Nobody renders better than me!</span>
114
+
<button>Click me!</button>
115
115
</Switch.Default>
116
116
</Switch>
117
117
);
118
118
```
119
119
120
120
## Why
121
121
122
-
In the example below you see a component named `UserList` that contains two very common use cases where you have to render something when a condition is true and render content from an array of data.
122
+
In the example below you see two very common use cases where you have to render something when a condition is true and render content from an array of data.
123
123
This is usually solved with inline arrow functions that are hard to read and easily becomes unmanageable in more complex components.
0 commit comments