score:15
I meet the similar problem before.I create my react app by create-react-app command.And find that you can only get the static file from the public folder.If you want to the get "db.json",you should put the "db.json" into the public folder.
score:3
I know that this question is answered long back. It will help people like me. Instead of using axios or other network libraries you can directly import the json file like below and return it in dispatcher. If you are using local json to test it why do you need network libraries.
import data from './response.json'
export function initializeApp() {
return function (dispatch) {
dispatch({
type: ActionTypes.ActionName,
payload: data
});
}
}
Source: stackoverflow.com
Related Query
- How to get data from local json file using actions and axios.get() (Redux)?
- Fetching data from local JSON file using axios and displaying data
- how to fetch json data from local file in redux by action
- How can i get a single data from local api using react and redux?
- How to concatenate URL and string, and get data from API at click a button using axios in REACT JS
- How can I get data from a local file into my React app?
- Unable to fetch data from local json file by axios
- How do I access data returned from an axios get to display on a web page using react js?
- How can I cache data that I already requested and access it from the store using React and Redux Toolkit
- How to get a data after react select using axios and ReactJS?
- How to retrieve data from the server using fetch get method and show it in a table
- How to get Image Url from local Json file in React.js
- How to retrieve data from Redux store using functional components and avoiding useSelector & useDispatch
- How to fetch and display data from json file in react typscript
- React - how to populate one select menu based on a value of another select menu using data from a local .json file
- How to Assign react redux state api get data using axios
- How to get nested Object from JSON File using React JS
- React with Redux Saga - How to get data back from axios call
- How to get the data from Redux store using class components in React
- How to get data from axios call in redux action? React JS search project
- Using data from API JSON object using Axios and React
- How do I display data from api using react and redux
- How to save data in state which I'm getting from redux and then render directly instead of using .map() function?
- React and Express: Using Axios to GET data from 3rd party API
- How to get a single data element from the database with Redux and React?
- How to get data using redux from api?
- How to display, add and delete items from JSON file using ReactJs
- Get API Json data in object and array format using redux and reactjs
- How to get data as JSON from this API and display in in my Reactjs app
- How to save fetched data from server to component state using redux and redux-thunk?
More Query from same tag
- IE 11 retrieving old version of the object with web sockets via Stompjs within ReactJS with Spring Boot/Spring Data REST
- Use Material Icon along with Styled-Components in react
- React app hosted on s3 unexpected token <
- React MapBox GL geocoder input outside the map is that possible?
- Why is POST request with pool.query only works intermittently when using :id in the middle of URL?
- React re-rendering every cell of the table
- Framer Motion: Fix child distortion when animated with AnimateSharedLayout
- Accessing previous theme variables in createMuiTheme
- How to manipulate a div using Active States in React?
- Custom useInput hook and typescript error
- How does shallow compare work in react
- Webpack imported class' function is undefined
- React setState is incorrectly updating
- How to use bootstrap or css for never appear scrollbar
- "Focus" prop is not changing properly between text fields in a array
- How to get all the child elements inside a component in unit test using react and enzyme?
- React with redux - alter response and then push to the store?
- Add link to Font Awesome icon in ReactJS
- reactjs enable disable button through a function not working
- Non breaking space for React?
- Shortcut of calling a method without writing parameters in Javascript
- Calling Props in JSX Invokes Invalid Syntax Error
- How to an update an api call after an action is dispatched with a dependant value which is updated
- Using webpack as build tool for React npm package
- Styled Components / React - Style on external element
- React : Maximum update depth exceeded
- Jest Enzyme how to shallow test for existence of wrapped component
- Javascript Parsing error : Unexpected Error
- How to clear previous leaflet layer after click on new one
- How to get React preventDefault to work 'e.preventDefault();' not working