This file contains hidden or 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 addBlog = () => { | |
const newBlog = { | |
title: newTitle, | |
author: newAuthor, | |
url: newUrl, | |
} | |
if(newBlog.title.length<4) | |
{ | |
return console.log('give longer value') |
This file contains hidden or 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
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<!-- This is an automatically generated file. | |
It will be read and overwritten. | |
DO NOT EDIT! --> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<TITLE>Bookmarks</TITLE> | |
<H1>Bookmarks</H1> | |
<DL><p> | |
<DT><H3 ADD_DATE="1639744473" LAST_MODIFIED="1639967469" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks</H3> | |
<DL><p> |
This file contains hidden or 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { createStore } from 'redux'; | |
const counterReducer = (state = 0,action) => { | |
switch(action.type){ | |
case 'INCREMENT': | |
return state + 1 | |
case 'DECREMENT': | |
return state - 1 |
This file contains hidden or 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
// import App from './App'; | |
import { createStore } from 'redux'; | |
const counterReducer = (state = 0,action) => { | |
switch(action.type){ | |
case 'INCREMENT': | |
return state + 1 |
This file contains hidden or 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
//ex.1: simple array | |
const average = (array) => { | |
const reducer = (sum, item) => { | |
return sum + item | |
} | |
return array.reduce(reducer, 0) / array.length | |
} | |
console.log(average([6,3,5,6])) | |
//output : 5 |
NewerOlder