Skip to content

How to use genConfig to create random avatar. #38

Answered by wwayne
Kedar-Khedkar asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, you can use genConfig without passing in any parameters, which will give you a random object which describes all the details about the avatar, then you can just put that object into the React component, e.g.:

import Avatar, { genConfig } from 'react-nice-avatar'
const config = genConfig() 
<Avatar style={{ width: '8rem', height: '8rem' }} {...config} />

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Kedar-Khedkar
Comment options

@wwayne
Comment options

Answer selected by wwayne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants