Skip to content

Commit 2b9c9fc

Browse files
update readme.md file
1 parent a692528 commit 2b9c9fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ yarn add string-to-react-component @babel/standalone
3434

3535
```js
3636
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
37-
<script src="https://unpkg.com/string-to-react-component@3.0.4/dist/stringToReactComponent.umd.min.js"></script>
37+
<script src="https://unpkg.com/string-to-react-component@3.1.0/dist/stringToReactComponent.umd.min.js"></script>
3838
```
3939

4040
## Basic Example
@@ -64,18 +64,18 @@ function App() {
6464

6565
- The given code inside the string should be a function.
6666

67-
- The code inside the string is executed in the global scope, so imported objects from `react` package including `useState`, `useEffect`, ... are not accessible inside it and you should get them from `React` global variable :
67+
- The code inside the string is executed in the global scope, so imported objects from `react` package including `useState`, `useEffect`, ... are not accessible inside it and you can get them from `React` global variable or pass them as props to the component :
6868

6969
```js
7070
import {useState} from 'react';
7171
import StringToReactComponent from 'string-to-react-component';
7272
function App() {
7373
return (
74-
<StringToReactComponent>
75-
{`()=>{
74+
<StringToReactComponent data={{useState}}>
75+
{`(props)=>{
7676
console.log(typeof useState); // undefined
7777
console.log(typeof React.useState); // function
78-
78+
console.log(typeof props.useState); // function
7979
...
8080
8181
}`}

0 commit comments

Comments
 (0)