Skip to main content

Posts

Showing posts from July, 2019

working code for chrome extension (Solution for "refused to execute inline script")

{ "short_name" : "React-Todo" , "name" : "My React Extention" , "manifest_version" : 2 , "browser_action" : { "default_popup" : "index.html" , "default_title" : "React Ext" }, "version" : "1.0" , "content_security_policy" : "script-src 'self' 'sha256-5As4+3YpY62+l38PsxCEkjB1R4YtyktBtRScTJ3fyLU='; object-src 'self'" } There might be an error related to sha. Check the error in the console log, it will log a sha .. replace the sha value with the value in the console log Good reference Link : https://codeburst.io/how-to-build-a-cross-browser-new-tab-apps-using-react-ba7d223ca6c6

react redux summary code

const {createStore} = Redux const initState = {   todos: [],   posts: [] } function myreducer(state = initState, action){   console.log(action, state)   if(action.type == 'ADD_TODO') {     return {       ...state,       todos: [...state.todos , action.todo ]     }   }     if(action.type == 'ADD_POST') {     return {       ...state,       posts: [...state.posts , action.posts ]     }   } } const store = createStore(myreducer) store.subscribe(() => {   console.log("state updates")   console.log(store.getState()) }) const todoAction = {   type: 'ADD_TODO',   todo: 'buy milk' } //dispatch action store.dispatch(todoAction) store.dispatch({type: 'ADD_TODO', todo: 'heera'}) store.dispatch({type: 'ADD_TODO', todo: 'keera'}) store.dispatch({type: 'ADD_POST', posts: 'POSTA ENTRY'})