score:0
are you getting error like ,'EVENTNAME' is not defined no-undef if that's the case, add declaration in front of function definition.
let EVENTNAME = e => {
console.log('called', e);
}
score:0
Problem solved define your images as
import React from "react";
import ImageGallery from "react-image-gallery";
import "./styles.css";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
slidesLoaded: 0
};
}
images = [
{
original: "https://picsum.photos/id/1018/1000/600/",
thumbnail: "https://picsum.photos/id/1018/250/150/"
},
{
original: "https://picsum.photos/id/1015/1000/600/",
thumbnail: "https://picsum.photos/id/1015/250/150/"
},
{
original: "https://picsum.photos/id/1019/1000/600/",
thumbnail: "https://picsum.photos/id/1019/250/150/"
}
];
checkAndShowSlider = e => {
console.log("called", e);
let count = this.images.length;
let nowLoaded = this.state.slidesLoaded + 1;
if (nowLoaded === count) {
document.querySelector(".images.section").css("display", "block");
}
this.setState(() => {
return {
slidesLoaded: nowLoaded
};
});
};
render() {
return (
<div className="App">
<ImageGallery
onImageLoad={e => this.checkAndShowSlider(e)}
items={this.images}
showPlayButton={false}
thumbnailPosition="left"
useBrowserFullscreen={false}
/>
</div>
);
}
}
export default App;
Source: stackoverflow.com
Related Query
- React Function is not returning component after being called from onchange method
- React.js function not being called on component event
- componentDidMount() not being called when react component is mounted
- Mocking Axios with Jest in React - mock function not being called
- React event listener function not called
- Axios not updating state from API in function called on Click, but works on identical function on Component Mount in React
- Component not mounted when setState called in arrow function in React with ES2016
- Pause function is being called inside react component but nothing happens
- React TransitionGroup lifecycle methods not being called when component is loaded
- React not rendering what is being returned by a function component
- react function not being called
- Why does the component is not re-rendering when i add @action decorator to an react event handler function
- Why is my function in React being called twice but not equaly executed?
- react component is not getting called at all from render function
- Mock function not being called using jest and testing library on react app
- React function not setting state after being called in constructor
- signalR connection.hub function not called in react component
- Jest mock is not being called when testing a react component
- Function not being passed as prop to child component in React
- Function in React fires but it's not being called
- React Component in Callback Function not called and not throwing any error
- Parameters of my function in React child component are not being passed to the parent component's function. Why is this happening?
- Function is not being called as it should in React onClick()
- Microsoft Graph toolkit component mgt-login event is not called in React App with hooks
- "this.props" not working in my on mouseup event function in Map Component using react and mapbox-gl
- React function is not being called back in render()
- React Component event handler function did not received the newest value from Redux Store
- GooglePicker's onChange() function is not being called in React programme
- React Parent Function Called from Child Component does not Update State?
- React - onChange event & function not working on imported Input component
More Query from same tag
- Sort array by dates in React JS
- Problems using React JS and WebSockets
- How to filter inside of map in redux reducer
- reactjs app fetch() returning mobile html
- Make a function call before any trigger in Javascript
- React conditional router for Cordova
- GeoChart with react-google-charts doesn't work
- Large console output produced by mini-css-extract-plugin
- React not updating style
- TypeError: firebase.analytics is not a function when mocking with jest
- React, TypeScript - Using non-React objects to inject components into component tree
- make a function with async call
- do we really need react portal
- How to deal with using socket.io client within React state?
- IE custom input showing the default appearance
- AngularJS app inside ReactJS component?
- React Firebase on refresh rdirects to login then to home page
- React - Test separate parent component (without redux)
- Error: Cannot find module 'react-dev-utils/getPublicUrlOrPath'
- How to access child state in react?
- Formik : Require validation only if the field is visible
- Variable in state undefined React.js
- ReactJS callback useEffect hook
- Cannot read property of undefined - small random quote app bug
- Using emmet with a react app in vs code is not working
- Compiling SASS files in React component folders
- Changing TextField color in a react/material ui
- How to connect two components in a same component created on click of add button
- Dynamic height for material ui tab containers
- Add Axios to React chart and take JSON data