8000 add component-props-more-than-string.md · learnreactjs/learnreactjs@70a7cb7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70a7cb7

Browse files
committed
add component-props-more-than-string.md
1 parent 3e2e08e commit 70a7cb7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Component Props More Than Strings
2+
3+
Before looking at validating props one needs to make sure they understand that a component prop can be any valid JavaScript value.
4+
5+
In the example below I setup several default props containing several different JavaScript values.
6+
7+
<p data-height="265" data-theme-id="dark" data-slug-hash="qYgpqX" data-default-tab="js,result" data-user="Bunlong" data-embed-version="2" data-pen-title="qYgpqX" class="codepen">See the Pen <a href="https://codepen.io/Bunlong/pen/qYgpqX/">qYgpqX</a> by Bunlong (<a href="https://codepen.io/Bunlong">@Bunlong</a>) on <a href="https://codepen.io">CodePen</a>.</p>
8+
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
9+
10+
Note how the `propArray` and `propObject` were overwritten with new values when the `MyComponent` instance is created.
11+
12+
The main take away here is that you are not limited to string values when passing prop values.

0 commit comments

Comments
 (0)
0