Generic dataloader for redux-thunk using axios Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?CRUD application using React-ReduxImplementing redirect in Redux middlewareReact/Redux 401 MiddlewareReact Redux quiz appRewriting Crime Map - React Component with ReduxReact Redux default playgroundSimple blog using react redux react-routerStatus dispatching of my redux-thunk async action (post request)A better way to retrieve data in firebase using reduxRedux: button click potentially fires 3 action for different reducers

Does the transliteration of 'Dravidian' exist in Hindu scripture? Does 'Dravida' refer to a Geographical area or an ethnic group?

Keep at all times, the minus sign above aligned with minus sign below

Is there a verb for listening stealthily?

Flight departed from the gate 5 min before scheduled departure time. Refund options

Where and when has Thucydides been studied?

newbie Q : How to read an output file in one command line

Where did Ptolemy compare the Earth to the distance of fixed stars?

malloc in main() or malloc in another function: allocating memory for a struct and its members

Did any compiler fully use 80-bit floating point?

Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

What does 丫 mean? 丫是什么意思?

Determine whether an integer is a palindrome

As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?

Vertical ranges of Column Plots in 12

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Why do C and C++ allow the expression (int) + 4*5;

How to resize main filesystem

Besides transaction validation, are there any other uses of the Script language in Bitcoin

Sally's older brother

Marquee sign letters

Fit odd number of triplets in a measure?

Is this Kuo-toa homebrew race balanced?

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?



Generic dataloader for redux-thunk using axios



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?CRUD application using React-ReduxImplementing redirect in Redux middlewareReact/Redux 401 MiddlewareReact Redux quiz appRewriting Crime Map - React Component with ReduxReact Redux default playgroundSimple blog using react redux react-routerStatus dispatching of my redux-thunk async action (post request)A better way to retrieve data in firebase using reduxRedux: button click potentially fires 3 action for different reducers



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4












$begingroup$


I am developing an application where there are lots of async actions. I wanted to go with redux-saga but most have insisted to continue with redux-thunk. In redux-thunk, inside each action we have to work with async operation using then, dispatch, catch, etc. This makes looks actions so messy and lots of code will be repeated. I wanted to create a generic dataLoader for the use of redux-thunk and axios.



Here is my attempt:



export class Company 
/**
* Generic api data loader
*/
static dataLoader(apiUri, onSuccess, onError, data, ...actionArguments)
const requestURL = `$API_BASE$apiuri`;
try
let options;
if (data !== undefined)
// if we have data to post
options =
method: 'POST',
url: requestURL,
body: JSON.stringify(data),
headers:
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest',
,
;


return function(dispatch)
axios(options)
.then(response =>
dispatch(
type: onSucess,
payload: response.data
);
)
.catch(error =>
dispatch( type: onError, payload: err);
);



static get(apiUri, onSuccess, onError, ...actionArguments)
return this.dataLoader(apiUri, onSuccess, onError, undefined, ...actionArguments);


/*
* Shorthand POST function
*/
static post(apiUri, onSuccess, onError, data, ...actionArguments)
return this.dataLoader(apiUri, onSuccess, onError, data, ...actionArguments);





I want to convert the following code to further this one:



export function showResultofApartment() 
return (dispatch) =>
dispatch( type: 'APARTMENT_FETCH_START' );
const token = localStorage.getItem('token');
return axios.get(`$API_URL/newoffers/apartment/`)
.then((response) =>
console.log('response apart', response.data);
dispatch( type: 'APARTMENT_FETCH_SUCCESS', payload: response.data );
)
.catch((err) =>
dispatch( type: 'APARTMENT_FETCH_FAILURE', payload: err );
);
;



to such or more efficient than this:



export function showResultofApartment() 
return(dispatch) =>
dispatch( type: APARTMENT_FETCH_START );
const token = localStorage.getItem('token');
return Company.get('/apartments', APARTMENT_FETCH_SUCCESS, APARTMENT_FETCH_ERROR);
// if post then Company.post('/apartment', APARTMENT_POST_SUCCESS, APARTMENT_POST_ERROR, data)




I have not tested this. I am just throwing my idea through code to get other experts idea on how I should handle such case for a more efficient technique without using other more external libraries.










share|improve this question











$endgroup$




bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    4












    $begingroup$


    I am developing an application where there are lots of async actions. I wanted to go with redux-saga but most have insisted to continue with redux-thunk. In redux-thunk, inside each action we have to work with async operation using then, dispatch, catch, etc. This makes looks actions so messy and lots of code will be repeated. I wanted to create a generic dataLoader for the use of redux-thunk and axios.



    Here is my attempt:



    export class Company 
    /**
    * Generic api data loader
    */
    static dataLoader(apiUri, onSuccess, onError, data, ...actionArguments)
    const requestURL = `$API_BASE$apiuri`;
    try
    let options;
    if (data !== undefined)
    // if we have data to post
    options =
    method: 'POST',
    url: requestURL,
    body: JSON.stringify(data),
    headers:
    'Content-Type': 'application/json',
    'X-Requested-With': 'XMLHttpRequest',
    ,
    ;


    return function(dispatch)
    axios(options)
    .then(response =>
    dispatch(
    type: onSucess,
    payload: response.data
    );
    )
    .catch(error =>
    dispatch( type: onError, payload: err);
    );



    static get(apiUri, onSuccess, onError, ...actionArguments)
    return this.dataLoader(apiUri, onSuccess, onError, undefined, ...actionArguments);


    /*
    * Shorthand POST function
    */
    static post(apiUri, onSuccess, onError, data, ...actionArguments)
    return this.dataLoader(apiUri, onSuccess, onError, data, ...actionArguments);





    I want to convert the following code to further this one:



    export function showResultofApartment() 
    return (dispatch) =>
    dispatch( type: 'APARTMENT_FETCH_START' );
    const token = localStorage.getItem('token');
    return axios.get(`$API_URL/newoffers/apartment/`)
    .then((response) =>
    console.log('response apart', response.data);
    dispatch( type: 'APARTMENT_FETCH_SUCCESS', payload: response.data );
    )
    .catch((err) =>
    dispatch( type: 'APARTMENT_FETCH_FAILURE', payload: err );
    );
    ;



    to such or more efficient than this:



    export function showResultofApartment() 
    return(dispatch) =>
    dispatch( type: APARTMENT_FETCH_START );
    const token = localStorage.getItem('token');
    return Company.get('/apartments', APARTMENT_FETCH_SUCCESS, APARTMENT_FETCH_ERROR);
    // if post then Company.post('/apartment', APARTMENT_POST_SUCCESS, APARTMENT_POST_ERROR, data)




    I have not tested this. I am just throwing my idea through code to get other experts idea on how I should handle such case for a more efficient technique without using other more external libraries.










    share|improve this question











    $endgroup$




    bumped to the homepage by Community 2 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      4












      4








      4





      $begingroup$


      I am developing an application where there are lots of async actions. I wanted to go with redux-saga but most have insisted to continue with redux-thunk. In redux-thunk, inside each action we have to work with async operation using then, dispatch, catch, etc. This makes looks actions so messy and lots of code will be repeated. I wanted to create a generic dataLoader for the use of redux-thunk and axios.



      Here is my attempt:



      export class Company 
      /**
      * Generic api data loader
      */
      static dataLoader(apiUri, onSuccess, onError, data, ...actionArguments)
      const requestURL = `$API_BASE$apiuri`;
      try
      let options;
      if (data !== undefined)
      // if we have data to post
      options =
      method: 'POST',
      url: requestURL,
      body: JSON.stringify(data),
      headers:
      'Content-Type': 'application/json',
      'X-Requested-With': 'XMLHttpRequest',
      ,
      ;


      return function(dispatch)
      axios(options)
      .then(response =>
      dispatch(
      type: onSucess,
      payload: response.data
      );
      )
      .catch(error =>
      dispatch( type: onError, payload: err);
      );



      static get(apiUri, onSuccess, onError, ...actionArguments)
      return this.dataLoader(apiUri, onSuccess, onError, undefined, ...actionArguments);


      /*
      * Shorthand POST function
      */
      static post(apiUri, onSuccess, onError, data, ...actionArguments)
      return this.dataLoader(apiUri, onSuccess, onError, data, ...actionArguments);





      I want to convert the following code to further this one:



      export function showResultofApartment() 
      return (dispatch) =>
      dispatch( type: 'APARTMENT_FETCH_START' );
      const token = localStorage.getItem('token');
      return axios.get(`$API_URL/newoffers/apartment/`)
      .then((response) =>
      console.log('response apart', response.data);
      dispatch( type: 'APARTMENT_FETCH_SUCCESS', payload: response.data );
      )
      .catch((err) =>
      dispatch( type: 'APARTMENT_FETCH_FAILURE', payload: err );
      );
      ;



      to such or more efficient than this:



      export function showResultofApartment() 
      return(dispatch) =>
      dispatch( type: APARTMENT_FETCH_START );
      const token = localStorage.getItem('token');
      return Company.get('/apartments', APARTMENT_FETCH_SUCCESS, APARTMENT_FETCH_ERROR);
      // if post then Company.post('/apartment', APARTMENT_POST_SUCCESS, APARTMENT_POST_ERROR, data)




      I have not tested this. I am just throwing my idea through code to get other experts idea on how I should handle such case for a more efficient technique without using other more external libraries.










      share|improve this question











      $endgroup$




      I am developing an application where there are lots of async actions. I wanted to go with redux-saga but most have insisted to continue with redux-thunk. In redux-thunk, inside each action we have to work with async operation using then, dispatch, catch, etc. This makes looks actions so messy and lots of code will be repeated. I wanted to create a generic dataLoader for the use of redux-thunk and axios.



      Here is my attempt:



      export class Company 
      /**
      * Generic api data loader
      */
      static dataLoader(apiUri, onSuccess, onError, data, ...actionArguments)
      const requestURL = `$API_BASE$apiuri`;
      try
      let options;
      if (data !== undefined)
      // if we have data to post
      options =
      method: 'POST',
      url: requestURL,
      body: JSON.stringify(data),
      headers:
      'Content-Type': 'application/json',
      'X-Requested-With': 'XMLHttpRequest',
      ,
      ;


      return function(dispatch)
      axios(options)
      .then(response =>
      dispatch(
      type: onSucess,
      payload: response.data
      );
      )
      .catch(error =>
      dispatch( type: onError, payload: err);
      );



      static get(apiUri, onSuccess, onError, ...actionArguments)
      return this.dataLoader(apiUri, onSuccess, onError, undefined, ...actionArguments);


      /*
      * Shorthand POST function
      */
      static post(apiUri, onSuccess, onError, data, ...actionArguments)
      return this.dataLoader(apiUri, onSuccess, onError, data, ...actionArguments);





      I want to convert the following code to further this one:



      export function showResultofApartment() 
      return (dispatch) =>
      dispatch( type: 'APARTMENT_FETCH_START' );
      const token = localStorage.getItem('token');
      return axios.get(`$API_URL/newoffers/apartment/`)
      .then((response) =>
      console.log('response apart', response.data);
      dispatch( type: 'APARTMENT_FETCH_SUCCESS', payload: response.data );
      )
      .catch((err) =>
      dispatch( type: 'APARTMENT_FETCH_FAILURE', payload: err );
      );
      ;



      to such or more efficient than this:



      export function showResultofApartment() 
      return(dispatch) =>
      dispatch( type: APARTMENT_FETCH_START );
      const token = localStorage.getItem('token');
      return Company.get('/apartments', APARTMENT_FETCH_SUCCESS, APARTMENT_FETCH_ERROR);
      // if post then Company.post('/apartment', APARTMENT_POST_SUCCESS, APARTMENT_POST_ERROR, data)




      I have not tested this. I am just throwing my idea through code to get other experts idea on how I should handle such case for a more efficient technique without using other more external libraries.







      javascript react.js redux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 31 '17 at 2:45









      Jamal

      30.6k11121227




      30.6k11121227










      asked May 31 '17 at 2:31









      TushantTushant

      1563




      1563





      bumped to the homepage by Community 2 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 2 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          This is one of the problems with async actions in redux-thunk. As you point out you have to create constants for "APARTMENT_FETCH_STATUS" and manually dispatch actions of this type before and after the request has been done.



          The redux-promise-middleware library actually does all this for you. You simply create an action like so:



          const foo = () => (
          type: 'FOO',
          payload: new Promise()
          );


          and the library will take care of dispatching an action of type "FOO_PENDING", and then of type "FOO_FULFILLED" when the promise has resolved. With redux-promise-middleware your actions would become something like this:



          const showResultOfApartment = () => (
          type: "FETCH_APARTMENT",
          payload: axios.get("http://api.com/apartments").then(result => result.data)
          )


          In your reducer you would create handlers for "FETCH_APARTMENT_PENDING", "FETCH_APARTMENT_FULFILLED" and "FETCH_APARTMENT_REJECTED". In the case where the promise fulfills or rejects, you also get the result of the promise by accessing action.payload. An example of what it could look like:



          function apartmentReducer(state, action)
          if(action.type === "FETCH_APARTMENT_PENDING")
          return Object.assign(, state, loading: true )

          else if(action.type === "FETCH_APARTMENT_FULFILLED")
          return Object.assign(, state, loading: false, apartment: action.payload )

          else if(action.type === "FETCH_APARTMENT_REJECTED")
          return Object.assign(, state, loading: false, error: action.payload )

          return state;



          redux-promise-middleware



          Introduction to redux-promise-middleware






          share|improve this answer









          $endgroup$













            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "196"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f164570%2fgeneric-dataloader-for-redux-thunk-using-axios%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            This is one of the problems with async actions in redux-thunk. As you point out you have to create constants for "APARTMENT_FETCH_STATUS" and manually dispatch actions of this type before and after the request has been done.



            The redux-promise-middleware library actually does all this for you. You simply create an action like so:



            const foo = () => (
            type: 'FOO',
            payload: new Promise()
            );


            and the library will take care of dispatching an action of type "FOO_PENDING", and then of type "FOO_FULFILLED" when the promise has resolved. With redux-promise-middleware your actions would become something like this:



            const showResultOfApartment = () => (
            type: "FETCH_APARTMENT",
            payload: axios.get("http://api.com/apartments").then(result => result.data)
            )


            In your reducer you would create handlers for "FETCH_APARTMENT_PENDING", "FETCH_APARTMENT_FULFILLED" and "FETCH_APARTMENT_REJECTED". In the case where the promise fulfills or rejects, you also get the result of the promise by accessing action.payload. An example of what it could look like:



            function apartmentReducer(state, action)
            if(action.type === "FETCH_APARTMENT_PENDING")
            return Object.assign(, state, loading: true )

            else if(action.type === "FETCH_APARTMENT_FULFILLED")
            return Object.assign(, state, loading: false, apartment: action.payload )

            else if(action.type === "FETCH_APARTMENT_REJECTED")
            return Object.assign(, state, loading: false, error: action.payload )

            return state;



            redux-promise-middleware



            Introduction to redux-promise-middleware






            share|improve this answer









            $endgroup$

















              0












              $begingroup$

              This is one of the problems with async actions in redux-thunk. As you point out you have to create constants for "APARTMENT_FETCH_STATUS" and manually dispatch actions of this type before and after the request has been done.



              The redux-promise-middleware library actually does all this for you. You simply create an action like so:



              const foo = () => (
              type: 'FOO',
              payload: new Promise()
              );


              and the library will take care of dispatching an action of type "FOO_PENDING", and then of type "FOO_FULFILLED" when the promise has resolved. With redux-promise-middleware your actions would become something like this:



              const showResultOfApartment = () => (
              type: "FETCH_APARTMENT",
              payload: axios.get("http://api.com/apartments").then(result => result.data)
              )


              In your reducer you would create handlers for "FETCH_APARTMENT_PENDING", "FETCH_APARTMENT_FULFILLED" and "FETCH_APARTMENT_REJECTED". In the case where the promise fulfills or rejects, you also get the result of the promise by accessing action.payload. An example of what it could look like:



              function apartmentReducer(state, action)
              if(action.type === "FETCH_APARTMENT_PENDING")
              return Object.assign(, state, loading: true )

              else if(action.type === "FETCH_APARTMENT_FULFILLED")
              return Object.assign(, state, loading: false, apartment: action.payload )

              else if(action.type === "FETCH_APARTMENT_REJECTED")
              return Object.assign(, state, loading: false, error: action.payload )

              return state;



              redux-promise-middleware



              Introduction to redux-promise-middleware






              share|improve this answer









              $endgroup$















                0












                0








                0





                $begingroup$

                This is one of the problems with async actions in redux-thunk. As you point out you have to create constants for "APARTMENT_FETCH_STATUS" and manually dispatch actions of this type before and after the request has been done.



                The redux-promise-middleware library actually does all this for you. You simply create an action like so:



                const foo = () => (
                type: 'FOO',
                payload: new Promise()
                );


                and the library will take care of dispatching an action of type "FOO_PENDING", and then of type "FOO_FULFILLED" when the promise has resolved. With redux-promise-middleware your actions would become something like this:



                const showResultOfApartment = () => (
                type: "FETCH_APARTMENT",
                payload: axios.get("http://api.com/apartments").then(result => result.data)
                )


                In your reducer you would create handlers for "FETCH_APARTMENT_PENDING", "FETCH_APARTMENT_FULFILLED" and "FETCH_APARTMENT_REJECTED". In the case where the promise fulfills or rejects, you also get the result of the promise by accessing action.payload. An example of what it could look like:



                function apartmentReducer(state, action)
                if(action.type === "FETCH_APARTMENT_PENDING")
                return Object.assign(, state, loading: true )

                else if(action.type === "FETCH_APARTMENT_FULFILLED")
                return Object.assign(, state, loading: false, apartment: action.payload )

                else if(action.type === "FETCH_APARTMENT_REJECTED")
                return Object.assign(, state, loading: false, error: action.payload )

                return state;



                redux-promise-middleware



                Introduction to redux-promise-middleware






                share|improve this answer









                $endgroup$



                This is one of the problems with async actions in redux-thunk. As you point out you have to create constants for "APARTMENT_FETCH_STATUS" and manually dispatch actions of this type before and after the request has been done.



                The redux-promise-middleware library actually does all this for you. You simply create an action like so:



                const foo = () => (
                type: 'FOO',
                payload: new Promise()
                );


                and the library will take care of dispatching an action of type "FOO_PENDING", and then of type "FOO_FULFILLED" when the promise has resolved. With redux-promise-middleware your actions would become something like this:



                const showResultOfApartment = () => (
                type: "FETCH_APARTMENT",
                payload: axios.get("http://api.com/apartments").then(result => result.data)
                )


                In your reducer you would create handlers for "FETCH_APARTMENT_PENDING", "FETCH_APARTMENT_FULFILLED" and "FETCH_APARTMENT_REJECTED". In the case where the promise fulfills or rejects, you also get the result of the promise by accessing action.payload. An example of what it could look like:



                function apartmentReducer(state, action)
                if(action.type === "FETCH_APARTMENT_PENDING")
                return Object.assign(, state, loading: true )

                else if(action.type === "FETCH_APARTMENT_FULFILLED")
                return Object.assign(, state, loading: false, apartment: action.payload )

                else if(action.type === "FETCH_APARTMENT_REJECTED")
                return Object.assign(, state, loading: false, error: action.payload )

                return state;



                redux-promise-middleware



                Introduction to redux-promise-middleware







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 31 '17 at 18:58









                MattMatt

                18615




                18615



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Code Review Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f164570%2fgeneric-dataloader-for-redux-thunk-using-axios%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

                    Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

                    Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar