import React from 'react'; import {Word} from './Word'; import {Button} from './Button'; export class Dictionary extends React.Component { constructor(props) { super(props); this.state = { name: this.props.reference.name, description: this.props.reference.description, createdBy: this.props.reference.createdBy, words: this.props.reference.words, nextWordId: this.props.reference.nextWordId, externalID: this.props.reference.externalID, allowDuplicates: this.props.reference.settings.allowDuplicates, caseSensitive: this.props.reference.settings.caseSensitive, partsOfSpeech: this.props.reference.settings.partOfSpeech, sortByEquivalent: this.props.reference.settings.sortByEquivalent, isComplete: this.props.reference.settings.isComplete, isPublic: this.props.reference.settings.isPublic } // this.addTestWord(); } showWords() { let words = this.state.words.map((word, index) => { return ; // return ; }); return
{words}
; } addTestWord() { this.setState({ words: this.state.words.concat([{ name: 'word', pronunciation: 'pronunciation', partOfSpeech: 'partOfSpeech', simpleDefinition: 'simpleDefinition', longDefinition: 'longDefinition', wordId: 'wordId' }]) }, () => console.log(this.state.words)); } changeTestWord() { this.setState( words[0].name: 'cool' ); } render() { return (

{this.state.name}

{this.state.createdBy}

Dictionary is complete: {this.state.isComplete.toString()}
{this.showWords()}
); } }