Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How can I import assets dynamically? #74

Closed
Math-42 opened this issue Apr 7, 2021 · 5 comments
Closed

[Question] How can I import assets dynamically? #74

Math-42 opened this issue Apr 7, 2021 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Math-42
Copy link

Math-42 commented Apr 7, 2021

How can I import aseets dynamically from the resources folder? like images and audios? it would be great if the template gave an example about it.

An example of what I mean:

export default function DivWithImage(props) {
    return (
      <div>
        <img src={props.src} />
      </div>
    )
}
@Math-42 Math-42 changed the title [Question] How can I import aseets dynamically? from the resources folder? like images and audios? [Question] How can I import aseets dynamically? f Apr 7, 2021
@Math-42 Math-42 changed the title [Question] How can I import aseets dynamically? f [Question] How can I import aseets dynamically? Apr 7, 2021
@reZach
Copy link
Owner

reZach commented Apr 8, 2021

@Math-42 You'll probably have to dynamically import the image in your DivWithImage method. You should be able to reference the source of the image if you stick your images in the resource directory.

@reZach reZach changed the title [Question] How can I import aseets dynamically? [Question] How can I import assets dynamically? Apr 21, 2021
@reZach
Copy link
Owner

reZach commented Apr 21, 2021

@Math-42 I'm assuming you figured this out? I'm going to close out this issue if I don't hear any update in a week.

@Math-42
Copy link
Author

Math-42 commented Apr 25, 2021

Actually it didn't work, can't find the asset in the resources folder

@reZach reZach added good first issue Good for newcomers help wanted Extra attention is needed labels May 5, 2021
@reZach
Copy link
Owner

reZach commented May 5, 2021

@Math-42 note that extraFiles can be used, and is used in the template today. Might point you in the right direction.

@reZach
Copy link
Owner

reZach commented Jan 4, 2022

@Math-42 I'm going to close this as I haven't heard any update in a number of months. Please re-open this if you continue to investigate this feature you are adding.

@reZach reZach closed this as completed Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants