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
/** | |
* Todo Root Container Component | |
*/ | |
import React, { useReducer, useCallback, useEffect } from 'react'; | |
import TodoItem from './TodoItem'; | |
import TodoInput from './TodoInput'; | |
const generateID = () => { | |
return Date.now().toString(36) + '-' + (Math.random() + 1).toString(36).substring(7); |
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
/** | |
* Todo Root Container Component | |
*/ | |
import React, { useReducer, useCallback, useEffect } from 'react'; | |
import TodoItem from './TodoItem'; | |
import TodoInput from './TodoInput'; | |
const generateID = () => { | |
return Date.now().toString(36) + '-' + (Math.random() + 1).toString(36).substring(7); |
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
useEffect(enqueuedActionFunction); |
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
/** | |
* Todo Root Container Component | |
*/ | |
import React, { useReducer, useCallback } from 'react'; | |
import TodoItem from './TodoItem'; | |
import TodoInput from './TodoInput'; | |
const generateID = () => { | |
return Date.now().toString(36) + '-' + (Math.random() + 1).toString(36).substring(7); |
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
const [state, dispatch] = useReducer(reducerFunction, initialState, stateInitializerFunction); |
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
/** | |
* TodoItem Component | |
*/ | |
import React, { useState, useCallback } from 'react'; | |
function TodoItem({ | |
id, | |
text, | |
toggleItemCompleted, |
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
/** | |
* TodoItem Component | |
*/ | |
import React, { useState, useCallback } from 'react'; | |
function TodoItem({ | |
id, | |
text, | |
toggleItemCompleted, |
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
/** | |
* TodoInput Component | |
*/ | |
import React, { useState, useCallback } from 'react'; | |
function TodoInput({ | |
onAdd | |
}) { | |
const [text, setText] = useState(''); |
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
const memoizedFunction = useCallback(inlineFunctionDefinition, memoizationArguments); |
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
/** | |
* TodoInput Component | |
*/ | |
import React, { useState } from 'react'; | |
function TodoInput({ | |
onAdd | |
}) { | |
const [text, setText] = useState(''); |
NewerOlder