How to use genConfig to create random avatar. #38
Answered
by
wwayne
Kedar-Khedkar
asked this question in
Q&A
-
Hey, I am using nice-avatar in my react project and want to generate random avatars from genConfig. Can you give me a code snippet for generating a random avatar? |
Beta Was this translation helpful? Give feedback.
Answered by
wwayne
Aug 16, 2022
Replies: 1 comment 2 replies
-
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} /> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
wwayne
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.: