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
Copy file name to clipboardExpand all lines: README.md
+71-14Lines changed: 71 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,14 @@
6
6
7
7

8
8
9
+
## 📜 Table content
10
+
11
+
-[Why](#why)
12
+
-[Usage](#usage)
13
+
-[Working with new Context api](#working-with-new-context-api)
14
+
-[Custom render and retrieving props from composed](#custom-render-and-retrieving-props-from-composed)
15
+
-[Typescript support](#typescript-support)
16
+
9
17
## 🧐 Why
10
18
11
19
[Render Props](https://reactjs.org/docs/render-props.html) are the new hype of React's ecossystem, that's a fact. So, when you need to use more than one render props component together, this can be boring and generate something called a *"render props callback hell"*, like that:
@@ -17,7 +25,7 @@
17
25
***Small**. 0.7kb minified!
18
26
***Extremely Simple**. Just a method!
19
27
20
-
React Adopt is just a simple method that you can compose your components and return all props in a function by mapping each child prop returned by your component.
28
+
React Adopt is just a simple method that you can compose your components and return just one component that will be a render prop component that combining each prop result from your mapper.
@@ -31,6 +39,27 @@ Now you can use adopt to compose your components. See above an example using the
31
39
32
40

33
41
42
+
### Working with new Context api
43
+
44
+
One of use case that React Adopt can fit perfectly is when you need to use [new React's context api](https://reactjs.org/docs/context.html) that use render props to create some context:
### Custom render and retrieving props from composed
35
64
36
65
Some components don't use the `children` property as render props. For cases like that, you can pass a function as mapper value that will return your component. This function will receive as props the `render` method, the props passed on `Composed` component and the previous values from each mapper. See an example:
0 commit comments