@@ -54,7 +54,7 @@ const HighlightNumbers = React.createClass({
54
54
const content = ' Hey my number is 555-555-5555.' ;
55
55
return (
56
56
< div>
57
- {reactStringReplace (this . props . content , / (\d + )/ g , (match , i ) => (
57
+ {reactStringReplace (content, / (\d + )/ g , (match , i ) => (
58
58
< span key= {i} style= {{ color: ' red' }}> {match}< / span>
59
59
))}
60
60
< / div>
@@ -74,18 +74,18 @@ const text = 'Hey @ian_sinn, check out this link https://github.com/iansinnott/
74
74
let replacedText;
75
75
76
76
// Match URLs
77
- replacedText = replaceString (text, / (https? :\/\/ \S + )/ g , match => (
78
- < a href= {match}> {match}< / a>
77
+ replacedText = reactStringReplace (text, / (https? :\/\/ \S + )/ g , ( match , i ) => (
78
+ < a key = {match + i} href= {match}> {match}< / a>
79
79
));
80
80
81
81
// Match @-mentions
82
- replacedText = replaceString (replacedText, / @(\w + )/ g , match => (
83
- < a href= {` https://twitter.com/${ match} ` }> @{match}< / a>
82
+ replacedText = reactStringReplace (replacedText, / @(\w + )/ g , ( match , i ) => (
83
+ < a key = {match + i} href= {` https://twitter.com/${ match} ` }> @{match}< / a>
84
84
));
85
85
86
86
// Match hashtags
87
- replacedText = replaceString (replacedText, / #(\w + )/ g , match => (
88
- < a href= {` https://twitter.com/hashtag/${ match} ` }> #{match}< / a>
87
+ replacedText = reactStringReplace (replacedText, / #(\w + )/ g , ( match , i ) => (
88
+ < a key = {match + i} href= {` https://twitter.com/hashtag/${ match} ` }> #{match}< / a>
89
89
));
90
90
91
91
// => [
0 commit comments