Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {useState, useEffect} from 'react';
- import Slider from "react-slick";
- import { AiOutlineArrowLeft, AiOutlineArrowRight } from "react-icons/ai";
- import './BannersWorks.css'
- import SliderComp, {SliderData} from "./SliderData";
- import Carousel from 'react-elastic-carousel'
- import axios from 'axios'
- const Banners = () => {
- const [data, setData]=useState([])
- const [imageIndex, setImageIndex] = useState(0);
- const [height, width] = useWindowSize();
- useEffect(async () => {
- var config = {
- method: 'get',
- url: '',
- headers: { }
- };
- await axios(config)
- .then(function (response) {
- console.log("This is the response from the banners api", JSON.stringify(response.data.data[0]));
- let newarray = []
- let count = 0
- for (count in response.data.data){
- newarray.push(response.data.data[count])
- count = count + 1
- }
- const anotherarray = newarray.map(({banner_image_id, title}) => {
- return ({banner_image_id, title} )
- })
- setData(anotherarray)
- console.log('this is the data', data)
- // run test functions below here data from Slider COMPONENT
- console.log("data from SLIDERCOMPONENT", SliderComp());
- })
- .catch(function (error) {
- console.log(error);
- });
- }, [])
- return()
- }
Advertisement
Add Comment
Please, Sign In to add comment