2020-02-03 09:38:42 +01:00
|
|
|
import React, { useContext } from "react"
|
|
|
|
|
import { WordFeederContext } from "../contexts/wordFeederContext"
|
2020-01-09 10:06:38 +01:00
|
|
|
|
2020-01-19 04:35:11 +01:00
|
|
|
export default React.memo(function ChallengeWord(props) {
|
2020-01-21 11:04:46 +01:00
|
|
|
|
2020-01-22 07:58:35 +01:00
|
|
|
let challengeWordClass= props.className
|
2020-02-03 09:38:42 +01:00
|
|
|
const {word} = useContext(WordFeederContext)
|
2020-01-21 11:04:46 +01:00
|
|
|
|
|
|
|
|
let challengeLetters = word.split('')
|
|
|
|
|
|
|
|
|
|
let spannedWord = challengeLetters.map((letter,index) => {
|
|
|
|
|
return (
|
2020-02-03 09:38:42 +01:00
|
|
|
<span key={index} className='cLetter'>{letter}</span>
|
2020-01-21 11:04:46 +01:00
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
2020-01-09 10:06:38 +01:00
|
|
|
return (
|
2020-01-22 07:58:35 +01:00
|
|
|
<div id="challengeWord" className={challengeWordClass}>{spannedWord}</div>
|
2020-01-09 10:06:38 +01:00
|
|
|
)
|
2020-01-19 04:35:11 +01:00
|
|
|
})
|