This component shows images in a neat square (or whatever dimensions you want) grid. Acts like facebooks image grids. Switches between two modes randomly (small images on right or bottom).
This component shows images in a neat square (or whatever dimensions you want) grid. Acts like facebooks image grids. Switches between two modes randomly (small images on right or bottom).
The component tries to figure out the best image to show as the main image (based on their dimensions).
#Usage
var imageData = [
'http://via.placeholder.com/400x400/',
'http://via.placeholder.com/500x700/',
'http://via.placeholder.com/600x500/',
'http://via.placeholder.com/600x800/'
];
// whereever you use ReactPhotoGrid
<ReactPhotoGrid
onImageClick={this.handleImageClick}
data={imageData}
/>
);
The dimensions of the final grid depends on the images provided and the amount of space in the parent container. If the widest image is selected as the hero image and the width of container element is more that that width, the grid width will be that images width.
To contain the grid width, you can do one of 3 things -
wxh
, width and height numbers separated by an x
. E.g. 500x500
;<ReactPhotoGrid
onImageClick={this.handleImageClick}
data={imageData}
gridSize="400x400"
/>
<div style={{width: 500}}>
<ReactPhotoGrid
onImageClick={this.handleImageClick}
data={imageData}
/>
</div>
<ReactPhotoGrid
onImageClick={this.handleImageClick}
data={imageData}
containerWidth={500}
/>
You can also pass gridSize as a property. It's a string which consists of width and height separated by an x. E.g. gridSize="500x500".
If you don't pass any gridSize, the grid size is chosen based on the parent's width.
Author: mukeshsoni
Demo: https://unstack.in/react-photo-grid/
Source Code: https://github.com/mukeshsoni/react-photo-grid
Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.
Increase Performance of React Applications Via Array JavaScript Methods. We will create a simple event management application in the react to add, update, and delete an event.
I have been using React JS in my projects for quite some time now and am used to managing routing in my app using the react-router package. I have always been keen on having as little dependencies in my apps as possible, so, I always felt perturbed by the use of this particular package in simpler apps which did not have complex routes.
In this post, I will share my own point of view about React Hooks, and as the title of this post implies, I am not a big fan.
This article will walk you through the concepts you would need to know to step into the world of widely used ReactJS.