Skip to content

Commit a388a8f

Browse files
committed
Readme update for character offset
1 parent 716f9d8 commit a388a8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ reactStringReplace('hey hey you', /(hey)/g, () => <span>hey</span>);
135135

136136
Type: `function`
137137

138-
The replacer function to run each time `match` is found. This function will be patched the matching string and an index which can be used for adding keys to replacement components if necessary.
138+
The replacer function to run each time `match` is found. This function will be patched the matching string and an `index` which can be used for adding keys to replacement components if necessary. Character `offset` identifies the position of match start in the provided text.
139139

140140
```js
141-
const func = (match, index) => <span key={index}>{match}</span>;
141+
const func = (match, index, offset) => <span key={index}>{match}</span>;
142142
reactStringReplace('hey hey you', /(hey)/g, func);
143143
```
144144

0 commit comments

Comments
 (0)