Created
March 23, 2019 17:07
-
-
Save danedavid/a4128ad06505d3841d110dfb0d0e9c4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { TextInputFormElement } from './TextInputFormElement'; | |
import { NumberInputFormElement } from './NumberInputFormElement'; | |
const data = ['a', 1, 'b', 2, 'c', 3, 'd', 4, 'e', 5]; | |
const App = () => { | |
const [activeElement, setActiveElement] = useState('a'); | |
return ( | |
<div id='intersector' className='intersection-line'> | |
<div className="app-container"> | |
{ | |
data.map(item => ( | |
typeof item === 'number' | |
? <NumberInputFormElement | |
active={activeElement === item} | |
key={item} | |
num={item} | |
setActiveElement={setActiveElement} | |
/> | |
: <TextInputFormElement | |
active={activeElement === item} | |
key={item} | |
char={item} | |
setActiveElement={setActiveElement} | |
/> | |
)) | |
} | |
</div> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment